Merge pull request #181 from iamsoorena/patch-2

updating array conactenation example to use ES6
This commit is contained in:
Angelos Chalaris
2017-12-16 13:38:29 +02:00
committed by GitHub

View File

@ -1,8 +1,8 @@
### Array concatenation
Use `Array.concat()` to concatenate an array with any additional arrays and/or values, specified in `args`.
Use Array spread operators (`...`) to concatenate an array with any additional arrays and/or values, specified in `args`.
```js
const ArrayConcat = (arr, ...args) => [].concat(arr, ...args);
const ArrayConcat = (arr, ...args) => [...arr,...args];
// ArrayConcat([1], [1, 2, 3, [4]]) -> [1, 1, 2, 3, [4]]
```