Created
May 7, 2013 14:01
-
-
Save eduardo-matos/5532792 to your computer and use it in GitHub Desktop.
Array - remove duplicate items.
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
function removeDuplicate(oldArray) { | |
var newArray = []; | |
var i = 0; | |
var len = oldArray.length; | |
for(; i < len; i++) { | |
if(newArr.indexOf(arr[i])<0) { | |
newArr.push(arr[i]) | |
} | |
} | |
return newArray; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment