Concatenate Variable Number of Input Arrays

Published by Helen Yu in

Create a function that concatenates n input arrays, where n is variable.

Examples

concat([1, 2, 3], [4, 5], [6, 7]) ➞ [1, 2, 3, 4, 5, 6, 7]

concat([1], [2], [3], [4], [5], [6], [7]) ➞ [1, 2, 3, 4, 5, 6, 7]

concat([1, 2], [3, 4]) ➞ [1, 2, 3, 4]

concat([4, 4, 4, 4, 4]) ➞ [4, 4, 4, 4, 4]

Notes

Arrays should be concatenated in order of the arguments.

Watch a quick demo on how Edabit works.