JavaScript Introducing ES2015 Classes Structure of Class

Libor Gess
Libor Gess
4,691 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
170,320 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
170,320 Points

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

And happy coding!