+ 2
Why does this output 'false'? Object comparison, see example...
var info1 = { "planet":"Earth", "suitable For Living":true }; var info2 = { "planet":"Earth", "suitable For Living":true }; alert(info1 === info2 || info1 == info2); gives 'false' is this because the object properties are strings which contain spaces?
1 ответ
+ 2
var info1 = {
};
var info2 = {
};
alert(info1 === info2 || info1 == info2);
also gives false.
it's true when i set
info2 = info1;
before the alert.
this means that objects are always different from one another, unless i set them equal