Skip to content

Instantly share code, notes, and snippets.

@aaei924
Created September 24, 2021 03:53
Show Gist options
  • Save aaei924/f2105e7ba184702f3dc2e86f6392d03d to your computer and use it in GitHub Desktop.
Save aaei924/f2105e7ba184702f3dc2e86f6392d03d to your computer and use it in GitHub Desktop.
Remove Duplicate Array Elements
const removeDuplicates = (inArray) => {
var arr = inArray.concat()
for(var i=0; i<arr.length; ++i) {
for(var j=i+1; j<arr.length; ++j) {
if(arr[i] === arr[j]) {
arr.splice(j, 1)
}
}
}
return arr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment