diff --git a/snippets/array-concatenation.md b/snippets/array-concatenation.md new file mode 100644 index 000000000..39d978d6e --- /dev/null +++ b/snippets/array-concatenation.md @@ -0,0 +1,8 @@ +### Array concatenation + +Use `Array.concat()` to concatenate and array with any additional arrays and/or values, specified in `args`. + +```js +const ArrayConcat = (arr, ...args) => arr.concat(...args); +// ArrayConcat([1], [1, 2, 3, [4]]) -> [1, 2, 3, [4]] +```