Created
December 19, 2015 06:16
-
-
Save pennyfx/8e5369f4a0b9bc478333 to your computer and use it in GitHub Desktop.
dedup
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
['3','4','3','7'].reduce(function(prev, item){ | |
if(!Array.isArray(prev)){ | |
prev = [prev]; | |
} | |
if(prev.indexOf(item.toLowerCase())===-1){ | |
prev.push(item.toLowerCase()); | |
} | |
return prev; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment