Created
April 17, 2018 04:44
-
-
Save AIndoria/6418125fb56ac40c3dec875f0476e3a4 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 diffArray(...arrs){ | |
| let newArray=[]; | |
| arrs.forEach(function(element){ | |
| element.forEach(function(newElement){ | |
| newArray.push(newElement); | |
| }); | |
| }); | |
| let result=newArray.filter(function(element){ | |
| return !arrs[0].includes(element); | |
| }); | |
| let result2=newArray.filter(function(element){ | |
| return !arrs[1].includes(element) | |
| }); | |
| return result.concat(result2); | |
| } | |
| diffArray([1,4,5,8], [1,2,3]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment