Which method would you use to get the prototype of an object?

JavaScript Developer Medium

JavaScript Developer — Medium

Which method would you use to get the prototype of an object?

Key points

  • Object.getPrototypeOf(obj) is the correct method to retrieve the prototype
  • obj.prototype is incorrect as it directly accesses the prototype property of the object itself
  • Object.protoOf(obj) is not a valid method in JavaScript
  • obj.__proto__() is incorrect syntax for accessing the prototype

Ready to go further?

Related questions