Skip to main content
InterviewHubPRO
Section Overview
Q263

Question 263 of 536

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

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

How do you get the prototype of an object

mid LevelMost AskedCode ExamplePrototypes

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