0 votes
in JavaScript by (30.6k points)

Which one of the given options can be considered as the correct output for the following JavaScript code?

const obj1 =  






const obj2 =Object.assign({c:7, d:1}, obj1);  

console.log(obj2.c, obj2.d);  

a) Undefined

b) 18,1

c) 7,1

d) Error

1 Answer

0 votes
by (30.8k points)

Answer: C

Reason: The "object.assign()" method mentioned in the above code, is used for copying the values and properties of one object to another. Here the objects are assigned and will be copied by the reference.

Related questions