How to check if two arrays are equal with JavaScript? [duplicate]

var a = [1, 2, 3];
var b = [3, 2, 1];
var c = new Array(1, 2, 3);

alert(a == b + "|" + b == c);

demo

How can I check these array for equality and get a method which returns true if they are equal?

Does jQuery offer any method for this?

16 Answers
16

Leave a Comment