What is a prototype in JavaScript?

  • A template object used for inheritance
  • A built-in JavaScript function for mathematical operations
  • An array of data
  • A type of loop construct
In JavaScript, a prototype is a template object that is used for inheritance. Each object in JavaScript has a prototype, and it allows objects to inherit properties and methods from other objects, creating a hierarchy of objects. Prototypal inheritance is a fundamental concept in JavaScript's object model.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *