0

Function

Why output false if consistence both object the same? https://code.sololearn.com/W4sbt54Q71vO/?ref=app

8th Jul 2019, 5:26 PM
Knozi
Knozi - avatar
2 odpowiedzi
+ 5
It's because it checks what they are referencing to. If you have the object {x: 1}, and {x: 1}, they will be different objects, with the same values. To make them true, you have to make their reference the same: a = {x: 1}; b = a; console.log(a == b); // True
8th Jul 2019, 5:30 PM
Airree
Airree - avatar
0
Wow! You awesome
8th Jul 2019, 5:35 PM
Knozi
Knozi - avatar