Implement a function that takes an array and additional arrays and/or values as arguments and returns a new array by concatenating them together.
Example
function customConcat(array, ...values) {
}
var array = [1];
console.log(customConcat(array, 2, [3], [[4]]));
// [1, 2, 3, [4]]
Solution
function customConcat(array, ...values) {
return array.concat(...values)
}
var array = [1];
console.log(customConcat(array, 2, [3], [[4]]));
// [1, 2, 3, [4]]
Top comments (0)