InterviewHubPRO
Section Overview
Q263

Question 263 of 521

Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

50%
JavaScript Internals (521 Qs)•Part 5: ES6+ Modern Syntax, Classes, Modules & Destructuring (254 - 328)

How do you get the prototype of an object

You can use the Object.getPrototypeOf(obj) method to return the prototype of the specified object. i.e. The value of the internal prototype property. If there are no inherited properties then null value is returned.

javascript
  const newPrototype = {};
  const newObject = Object.create(newPrototype);

  console.log(Object.getPrototypeOf(newObject) === newPrototype); // true