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 Token Properties Solution

id & dropped omitted.

Why did she omit the 'id' and 'dropped' parameters?

1 Answer

Steven Parker
Steven Parker
231,248 Points

There's an error in the video. At the bottom of the page, on the "Teacher's Notes" tab, there is an explanation with revised code under the heading "Code Correction".

Actually, there's no answer for this on the "Teacher's Notes", and the dropped property is not clear to me yet.

The id of the token is generated by inserting an index and appending the and id which we will take from the owner. So that I get.

But why is there no 'dropped' argument passed to the token constructor? only owner and index.

Steven Parker
Steven Parker
231,248 Points

No argument is needed for the "dropped" attribute because the initial value of "dropped" is always "false":

        this.dropped = false;  // as set in the constructor