Skip to content

Instantly share code, notes, and snippets.

@aarjithn
Last active October 20, 2015 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarjithn/4cf420709f84542968c2 to your computer and use it in GitHub Desktop.
Save aarjithn/4cf420709f84542968c2 to your computer and use it in GitHub Desktop.
Check if there are duplicate (primitive) values in array
function checkIfUnique(array) {
var map = {};
for(var i = 0, size = array.length; i < size; i++) {
if (map[array[i]]) {
return false;
}
map[array[i]] = true;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment