Created
December 21, 2011 16:15
-
-
Save h2rd/1506591 to your computer and use it in GitHub Desktop.
This file contains 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
var unique = function(origArr) { | |
var newArr = [], | |
origLen = origArr.length, | |
found, | |
x, y; | |
for ( x = 0; x < origLen; x++ ) { | |
found = undefined; | |
for ( y = 0; y < newArr.length; y++ ) { | |
if ( origArr[x] === newArr[y] ) { | |
found = true; | |
break; | |
} | |
} | |
if ( !found) newArr.push( origArr[x] ); | |
} | |
return newArr; | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment