Let's make the function unite
, which
will take an arbitrary number of arrays as
parameters and merge them into one
two-dimensional one.
Here is an example of the described function:
let result = unite([1, 2, 3], [4, 5, 6], [7, 8, 9]);
console.log(result); // shows [ [1, 2, 3,] [4, 5, 6], [7, 8, 9] ]
Despite the sufficient complexity of the function, its implementation using the rest operator will be very concise:
function unite(...arrs) {
return arrs;
}