+ 1

Why the Outputs is false?

Why the Outputs is false when I code this? var a= {value:20}; var b= {value:20}; document.write(a==b);

25th Sep 2017, 5:10 PM
0110100
0110100 - avatar
2 ответов
+ 7
You are comparing objects not values. You and you friend can be the same age but that does not make you the same person.
25th Sep 2017, 5:26 PM
sneeze
sneeze - avatar
+ 1
If you want to compare the value, use a.value and b.value instead.
25th Sep 2017, 11:39 PM
Khun Ling Tan
Khun Ling Tan - avatar