Last active
August 23, 2018 01:12
-
-
Save luislobo14rap/eb1fb243f3c5682f635237cff59c657a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// arrayUnique.js v1 | |
function arrayUnique(array) { | |
let newArray = []; | |
for (let i = 0; i < array.length; i++) { | |
if (newArray.indexOf(array[i]) == -1) { | |
newArray.push(array[i]); | |
}; | |
}; | |
return newArray; | |
}; | |
Array.prototype.unique = function() { | |
return arrayUnique(this); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// arrayUnique.min.js v1 | |
function arrayUnique(a){let b=[];for(let c=0;c<a.length;c++)-1==b.indexOf(a[c])&&b.push(a[c]);return b}Array.prototype.unique=function(){return arrayUnique(this)}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment