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 Board and Space Class Constructor Methods Solution

Why not this.row=new row(6); ?

Why not

this.row=new row(6); ?

3 Answers

Steven Parker
Steven Parker
229,644 Points

This syntax would create a new instance of a "row" class, but there is no class by that name in this video.

There is also no "row" (singular) property, and the "rows" (plural) property only contains a plain number.

this.row=new row(6) will create an instance of the object row which we don't have.

Hubert Odias
Hubert Odias
1,898 Points

I am new with javascript. So bear with me. This may have a new instance as if you are declaring a new variable. The new keyword is usually used to create a new object, variable.

used MDN to refer back to the new keyword

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new