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 trialAdam Lyles Kauffman
14,016 Pointsorder of classes
im pretty confused. how come the Student class cannot be declared before the person class? Maybe there is something i didn't understand. I thought I understood hoisting. it was basically to define the class before calling the class. I don't see how a different order of classes affect anything as long as you call them after they are both defined. Please and Thank you for the help.
1 Answer
Steven Parker
231,248 PointsYou're right that you should define a class before you call it. But that's not "hoisting" .. and in fact class declarations are not hoisted in JavaScript.
The issue here is "dependency", which means that you should always define a class before any others that reference it. Since a Student
is a special kind of Person
then Person
needs to be defined first.