- 1

what is the output of this code?

const obj1 = { a: 0 b: 2 c: 4 }; const obj2 = Object.assign({c: 5, d: 6}, obj 1); console. log(obj2.c, obj2.d);

13th Nov 2020, 7:42 PM
Sohila
Sohila - avatar
2 Answers
+ 3
Obj2 is created and assigned values c:5,d:6,then total obj1 values to obj2 values overriding existing ones... So obj2 = { a:0,b:2,c:4,d:6} So output : obj2.c = 4, obj2.d = 6 output. 4 6
13th Nov 2020, 8:00 PM
Jayakrishna 🇼🇳
0
4,6
16th Dec 2021, 5:57 AM
Nazma