Created
February 2, 2016 12:26
-
-
Save srkama/bd12917fd999b6c985db to your computer and use it in GitHub Desktop.
unique elements in an array
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 unite(arr1, arr2, arr3) { | |
| return Array.prototype.slice.call(arguments).reduce(function(a,b) { | |
| for(i=0;i<b.length;i++) { | |
| if(a.indexOf(b[i])==-1) { | |
| a.push(b[i]) | |
| } | |
| } | |
| return a; | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment