Created
July 18, 2019 16:16
-
-
Save parzibyte/241d5668933ebddb30f93fdb01ebb42e to your computer and use it in GitHub Desktop.
Eliminar duplicados de arreglo con JavaScript usando conjuntos https://parzibyte.me/blog/2018/12/04/eliminarduplicados-arreglos-javascript/
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
/* | |
Convertirlo a conjunto y después a arreglo | |
Visita: parzibyte.me | |
*/ | |
let arregloConRepetidos = [1, 2, 3, 4, 1, 2, 2, 2, 10]; | |
console.log("Con repetidos es:", arregloConRepetidos); | |
let sinRepetidos = [...new Set(arregloConRepetidos)]; | |
console.log("Sin repetidos es:", sinRepetidos); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment