var a = [1,2,3] var b = a.sort(); console.log(\'a\',a,\'b\',b); // a [1,2,3] b [1,2,3] console.log(a === b); // true a = [1,3,2]; console.log(a.sort() === b) // false
When comparing two arrays the return value is true if they are referring to the same object. The values or the content of the arrays are not compared.
true