10 Interview Questions Every JavaScript Developer Should Know
Eric Elliott
22K136

Do you believe in class inheritance? You know, this isn’t religion, its programming. I don’t believe in dogmatic coding. I believe in class inheritance for Java, because the compiler and IDE will help you.

In JavaScript, I believe in inheritance less. I think _.extend usually works fine, because it’s all duck-typing anyway.

That being said, will I run away from Backbone’s .extend function like it’s the plague? No. Most of my Backbone classes don’t inherit, but if I have two similar models, I might base them off of a base model. I don’t create the kinds of hierarchies Java requires, and actually makes good use of. But again, once in a while, I’ll make a base class and maybe two different flavors of it, if it makes sense.

Also, in terms of inheritance in JavaScript, I think it’s important to note the light-weight decorator patterns you can use in JavaScript. It’s one of the languages best features.

Like what you read? Give TED Talks have no value a round of applause.

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