Skip to content

Instantly share code, notes, and snippets.

@rike422
Last active December 18, 2015 15:08
Show Gist options
  • Save rike422/5801928 to your computer and use it in GitHub Desktop.
Save rike422/5801928 to your computer and use it in GitHub Desktop.
重複検出
function dupulicate(array) {
var storage = {};
var duplicateArray = [];
var i,value;
for ( i=0; i < array.length; i++) {
value = array[i];
if (value in storage) {
duplicateArray.push(value);
} else {
storage[value] = true;
}
}
return duplicateArray;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment