Skip to content

Instantly share code, notes, and snippets.

@abrahamfast
Last active August 29, 2015 14:19
Show Gist options
  • Save abrahamfast/66d3adcef53c2a227227 to your computer and use it in GitHub Desktop.
Save abrahamfast/66d3adcef53c2a227227 to your computer and use it in GitHub Desktop.
function unique array
var a=[1,5,1,6,4,5,2,5,4,3,1,2,6,6,3,3,2,4];
function unique(list) {
var result = [];
$.each(list, function(i, e) {
if ($.inArray(e, result) == -1) result.push(e);
});
return result;
}
var unique = a.filter(function(itm,i,a){
return i == a.indexOf(itm);
});
@abrahamfast
Copy link
Author

Work Easy 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment