This won't work if objects contain equal pairs of key:value but in different order. You can't compare objects converting them to string. That's asking for trouble.
–
alexandernstSep 13 '12 at 18:36

1

Comparing objects by converting them to a string isn't a good idea in any language, nor a good option for anything. Don't try to compare lemons with apples by painting the lemons in red.
–
alexandernstSep 13 '12 at 18:47

You must write code to compare each element of an array to accomplish your objective.

// this is one way of doing it, and there are caveats about using instanceOf.
// Its just one example, and presumes primitive types.
function areArrayElementsEqual(a1, a2)
{
if (a1 instanceof Array) && (a2 instanceof Array)
{
if (a1.length!=a2.length)
return false;
else{
var x;
for (x=0;x<a1.length; x++)
if (a1[x]!=a2[x])
return false;
}
}
return true;
}