Hacker News new | past | comments | ask | show | jobs | submit login

In the case of User.getName, why do you re-define that method just to call the prototype's method? Doesn't creating the object from the parent prototype bring that getName method to the User object for free?

Or, were you demonstrating the method overriding + calling to parent use case?




> Or, were you demonstrating the method overriding + calling to parent use case?

Yep. This gist is what I run co-workers through for demonstrating OOP in JS.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: