Created
February 14, 2019 15:48
-
-
Save ristaa/9b1dd60486b871fa7c08aec72fd7511b to your computer and use it in GitHub Desktop.
Concatenation of arrays
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
/* | |
* Concatenation of arrays | |
* @arguments Arrays | |
*/ | |
concatArrays = (...arrays) => { | |
var children = [].concat(...arrays); | |
return children; | |
} | |
let arr1 = ['a', 'c']; | |
let arr2 = ['d', 'g']; | |
let arr3 = ['d', 'f']; | |
console.log(concatArrays(arr1, arr2, arr3)); // ["a", "c", "d", "g", "d", "f"] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment