I am having trouble translating the code into function, please help

Original code:
Code:
var left_edge; left_edge = 100;
	var top_edge; top_edge = 100;
	var size = 50;
	var size = 100;
	var square_color; square_color = 'red';
	var color1 = 'red';
	var color2 = 'black'; square_color = color2;
	var which_color;
	var column;
	var row;
	for (row=0;row<8;row++)
	{
		which_color=row%2;
		for (column=0; column<8; column++)
		{
			if ((column%2)==which_color)
			square_color=color1; 
			else 
			square_color=color2;
			fillRectangle(left_edge+size*column, top_edge+size*row, size ,size, square_color);
		}
	}
Failed Code:
Code:
function make_column (left_edge, top_edge, size, square_color)
	{
		fillRectangle (left_edge, top_edge, size, size, square_color)
	}
	
	function make_row (left_edge, top_edge, size, size, which_color, color_1, color_2)
	{
		for (row=0;row<8;row++)
		{
			which_color=row%2;
			for (column=0; column<8; column++)
			{
				if ((column%2)==which_color)
				square_color=color_1; 
				else 
				square_color=color_2;
				fillRectangle (left_edge+size*column, top_edge+size*row, size ,size, square_color);
			}
		}
	}
	make_row (100, 100, 50, 100, 'black', 'red');