How can I find out why two Array
instances are comparing unequal?
I have two Array
instances that appear to be the same:
js> messageTexts
Array [ "Nostrum porro quo laborum", "Corrupti animi architecto dicta", "Lorem ipsum, dolor sit amet", "Nulla ipsa veniam eveniet veniam", "" ]
js> expectedMessageTexts
Array [ "Nostrum porro quo laborum", "Corrupti animi architecto dicta", "Lorem ipsum, dolor sit amet", "Nulla ipsa veniam eveniet veniam", "" ]
The type and length are identical; each element is identical to the corresponding element in the other array:
js> typeof(messageTexts) === typeof(expectedMessageTexts)
true
js> messageTexts.length === expectedMessageTexts.length
true
js> messageTexts.map(function (item, index) {return item === expectedMessageTexts[index];})
Array [ true, true, true, true, true ]
js> expectedMessageTexts.map(function (item, index) {return item === messageTexts[index];})
Array [ true, true, true, true, true ]
But somehow the arrays still compare unequal:
js> messageTexts == expectedMessageTexts
false
js> messageTexts === expectedMessageTexts
false
What can be different between those two, that would make them appear to be equal by all the earlier tests, but still compare unequal?