Created
August 13, 2019 23:09
-
-
Save parzibyte/c769bccda6c307f7b1e0f015124dec97 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
/** | |
* Diferencia de arreglos en JavaScript | |
* Obtener elementos que existen en arreglo A pero no en arreglo B | |
* | |
* @author parzibyte | |
* | |
* https://parzibyte.me/blog | |
* | |
*/ | |
// Obtener elementos que existen en un arreglo | |
// pero no en otro | |
const diferenciaDeArreglos = (arr1, arr2) => { | |
return arr1.filter(elemento => arr2.indexOf(elemento) == -1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment