MCQ Single Best Answer Easy

QWhat would the following JavaScript code produce?
const prototype1 = {};  
const object1 = Object.create(prototype1);  
console.log(Object.getPrototypeOf(object1) === prototype1);

ID: #5001 Javascript Classes MCQ 184 views
Question Info
#5001Q ID
EasyDifficulty
Javascript Classes MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A true
  • B false
  • D error
Correct Answer: Option A

Explanation

The Object.getPrototypeOf() method in JavaScript is used to get the prototype of an object. It returns the value of the prototype, which is the object that the object inherits properties and methods from.
The Object.getPrototypeOf() method does not return inherited properties of the object, only the prototype value.

Share This Question

Challenge a friend or share with your study group.