MCQ
Single Best Answer
Easy
QWhat would the following JavaScript code produce?
const obj1 =
{
a: 10,
b: 15,
c: 18
};
const obj2 = Object.assign({c: 7, d: 1}, obj1);
console.log(obj2.c, obj2.d);
ID: #4998
Javascript Classes MCQ
219 views
Question Info
#4998Q ID
EasyDifficulty
Javascript Classes MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option A
Explanation
The Object.assign() method is used to copy the properties and values from one or more source objects to a target object. It returns the target object. When objects are assigned or copied using Object.assign(), they are assigned or copied by reference, meaning that the target object and the source object refer to the same underlying object in memory.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic