This is a general question about javascript object ontology and the way the ===
operator works.
start with an example:
var z = [1];
z === [1] // returns false.
Totally blew my mind. Why??
I guess it has to be that ===
is comparing the array as an object (i.e. by its object id or whatever), than by comparing the contents of the object--which would return true.
So what is a good way to compare the contents of an object like that?
You can force the issue by converting z.toString()
, and comparing the result, but this seems crude.