Created
November 2, 2020 23:53
-
-
Save heanfig/43c041eef6c373df99e381cb5e8bff00 to your computer and use it in GitHub Desktop.
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 sym(...args) { | |
return args.reduce( (a,b,i) => { | |
const valoresA = a.filter(item => !b.find(aux=>aux===item)); | |
const valoresB = b.filter(item => !a.find(aux=>aux===item)); | |
const resultado = new Set([...valoresA, ...valoresB]); | |
return [...resultado] | |
},[]); | |
} | |
console.log(sym([3, 3, 3, 2, 5], [2, 1, 5, 7], [3, 4, 6, 6])); //[1, 7, 4, 6] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment