Front End Programmer Question:

Download Job Interview Questions and Answers PDF

Explain what is the difference between a prototype and a class?

Front End Developer Interview Question
Front End Developer Interview Question

Answer:

Prototype-based inheritance allows you to create new objects with a single operator; class-based inheritance allows you to create new objects through instantiation. Prototypes are more concrete than classes, as they are examples of objects rather than descriptions of format and instantiation.

Prototypes are important in JavaScript because JavaScript does not have classical inheritance based on classes; all inheritances happen through prototypes. If the JavaScript runtime can't find an object's property, it looks to the object's prototype, and continues up the prototype chain until the property is found.

Download Front End Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Tell me what is the difference between call and apply?What are the difference between GET and POST?