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 Introducing ES2015 Classes Structure of Class

Libor Gess
Libor Gess
6,880 Points

Why I am getting different result of the video?

when the teacher call node he got this result:

treehouse:~/workspace$ node constructor-function.js { name: 'Joey', age: 25 } { name: 'Sarah', age: 22 }

But when I call the node the same way I got this:

treehouse:~/workspace$ node constructor-function.js Student { name: 'Joey', age: 25 } Student { name: 'Sarah', age: 22 }

Than I cannot see the different quite confused.

2 Answers

Steven Parker
Steven Parker
231,261 Points

I'd guess you are using a newer version of node than the one used to make the video, and displaying the class name before the instance contents is a new feature.

Steven Parker
Steven Parker
231,261 Points

Libor Gess — Glad to help. You can mark a question solved by choosing a "best answer".

And happy coding!