Skip to content

Instantly share code, notes, and snippets.

@garystorey
Created May 20, 2015 20:33
Show Gist options
  • Select an option

  • Save garystorey/e0d658bd64f630ecde79 to your computer and use it in GitHub Desktop.

Select an option

Save garystorey/e0d658bd64f630ecde79 to your computer and use it in GitHub Desktop.
function uniques(array) {
var result = [], val, ridx;
outer:
for (var i = 0, length = array.length; i < length; i++) {
val = array[i];
ridx = result.length;
while (ridx--) {
if (val === result[ridx]) continue outer;
}
result.push(val);
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment