Skip to content

Instantly share code, notes, and snippets.

@ondrek
Created January 9, 2014 21:34
Show Gist options
  • Save ondrek/8342481 to your computer and use it in GitHub Desktop.
Save ondrek/8342481 to your computer and use it in GitHub Desktop.
Remove from array all repeated items and return only uniq values in array
var _getUniqItemsFromArray = function(array){
var temp = {};
var uniqueArray = [];
for (var i = 0; i < array.length; i++) {
temp[array[i]] = true;
}
for (var k in temp) {
uniqueArray.push(k);
}
return uniqueArray;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment