InterviewHubPRO
Section Overview
Q181

Question 181 of 521

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

35%
JavaScript Internals (521 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

What is the difference between proto and prototype

The __proto__ object is the actual object that is used in the lookup chain to resolve methods, etc. Whereas prototype is the object that is used to build __proto__ when you create an object with the new operator (a special variant of a function call).

javascript
  new Employee().__proto__ === Employee.prototype;
  new Employee().prototype === undefined;

There are few more differences,

featurePrototypeproto
AccessAll function constructors have prototype properties.All objects have __proto__ property
PurposeUsed to reduce memory wastage with a single copy of functionUsed in lookup chain to resolve methods, constructors etc.
ECMAScriptIntroduced in ES6Introduced in ES5
UsageFrequently usedRarely used