QWhat would the following JavaScript code produce?
const prototype1 = {};
const object1 = Object.create(prototype1);
console.log(Object.getPrototypeOf(object1) === prototype1);
Question Info
Choose the Best Option
Click any option to instantly check if you're correct.
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.
Want to remember what you got wrong?
Create a free account in seconds to track your score, revisit mistakes and continue Computer Science and Engineering where you left off.
- Save your progress & streak
- Topic-wise quizzes & scores
- Bookmark tricky questions
- Printable MCQ sets
Nice — 3 questions done!
Don't lose this streak. Sign up free to save your score and pick up exactly where you stopped.
Share This Question
Challenge a friend or share with your study group.