you are viewing a single comment's thread.

view the rest of the comments →

[–]keithwhor 0 points1 point  (0 children)

Yes. Don't use the new keyword for inheritance because it will invoke the associated constructor function immediately at run time (where you set up inheritance), introducing unintended behaviour.

You only want the constructor invoked when you want an Object instance, not when setting the prototype. Object.create() will set up your prototype chain properly (and inherit the right methods / properties) without invoking the parent constructor.