Saturday, July 28, 2012

Array Unique in Jquery

Here is the code to remove the duplicates from an array in Jquery.

in below code countries is an array which contains all the elements.

var unique_countries = countries.filter(function(itm,i,countries){return i == countries.indexOf(itm);});