MCQ Practice Single Best Answer Topic: Javascript Classes MCQ

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

Question ID
#5001
Subchapter
Javascript Classes MCQ
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A true
  • B false
  • D error
Correct Answer: 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

Share this MCQ with your friends or study group.