Created
October 5, 2016 12:54
-
-
Save gustavom/d28d92fb948ad7b3a8fefa29cead43e1 to your computer and use it in GitHub Desktop.
Filtragem de valores repetidos de um array, gerando um novo array
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 arr = ['foo', 'bar', 'foo']; | |
var novaArr = arr.filter(function(este, i) { | |
return arr.indexOf(este) == i; | |
}) | |
console.log(novaArr); //dá ['foo', 'bar'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment