Skip to content

Instantly share code, notes, and snippets.

@guipn
Created March 10, 2014 00:44
Show Gist options
  • Save guipn/9457511 to your computer and use it in GitHub Desktop.
Save guipn/9457511 to your computer and use it in GitHub Desktop.
Are all values unique?
function allUnique(values) {
return values.reduce(function (unique, next) {
if (unique.indexOf(next) === -1) {
unique.push(next);
}
return unique;
}, []).length === values.length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment