Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Object-Oriented JavaScript: Challenge Building Constructor Methods and Generating Objects createSpaces() Method Solution

Gonzalo Torres del Fierro
PLUS
Gonzalo Torres del Fierro
Courses Plus Student 16,751 Points

hello, I just want to ask, if I understand ok? column.push(column)

I think the result of this should be an Array like this:

spaces =[(x1,y1);(x2,y2);(x3,y3)..............(xn,yn)]; right? so, each element of the array named spaces it is a coordinate on the board.

1 Answer

Heidi Puk Hermann
Heidi Puk Hermann
33,366 Points

The spaces-array is a two dimensional array, so it would look like this:

spaces = [column1, column2, column3, ...];

or to be more precise:

spaces = [[(x1,y1), (x1,y2), (x1,y3), ...], 
                 [(x2,y1), (x2,y2), (x2,y3), ...], 
                 [(x3,y1), (x3,y2), (x3,y3), ...],
                 ...];

that is also why you have to access a specific point with both coordinates,

(x1, y1) = spaces[0][0];