The description of jQuery.unique() states:
Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays
var array=['a','b','c','a']; function unique(array) { var unique_arr=[]; array.forEach(function(i,e) { if(unique_arr.indexOf(i)===-1) unique_arr.push(i); }); return unique_arr; } console.log(unique(array));