Common Misconceptions About Inheritance in JavaScript
Eric Elliott

Interesting article. Also, you have awesome hair.

One interesting thing I noticed when reading this was: With constructors, you can’t use ES5 getter/setters with them, you can only use them with object literals. For example, in your last example with a private var, it could also easily be written like so:

var secret = 'secret agent';
get profession () {
return secret;

Doing that with constructors is impossible. Doing that with ES6 classes is possible, but as far as I know, there’s no concept of a private var within the context of a class in ES6. So it’s also not possible.

Another thing you can’t do easily with constructors/classes is use .call() or .apply() on them. (It’s possible, just not a pretty solution). Not an issue with this pattern.

It’s as if there’s a lot of powerful features and methods on Object that work really well with this style of object instantiation but don’t work with the constructor or class pattern. Cool stuff.

Like what you read? Give Cameron Nokes a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.