Skip to main content
2 of 4
example added, links included
Tim Büthe
  • 63.9k
  • 17
  • 96
  • 130

jQuery does not have a method for comparing arrays. However the Underscore library does have such a method: isEqual, and it can handle a variety of other cases (like object literals) as well. To stick to the provided example:

var a=[1,2,3]; var b=[3,2,1]; var c=new Array(1,2,3); alert(_.isEqual(a, b) + "|" + _.isEqual(b, c)); 

By the way: Underscore has lots of other methods that jQuery is missing as well, so it's a great complement to jQuery.

machineghost
  • 36k
  • 33
  • 174
  • 271