mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-07 00:03:44 -05:00
fix(curriculum): array spread syntax example (#50416)
array literal spread syntax #50414 fixed
This commit is contained in:
@@ -28,7 +28,13 @@ const maximus = Math.max(...arr);
|
||||
|
||||
`maximus` would have a value of `89`.
|
||||
|
||||
`...arr` returns an unpacked array. In other words, it *spreads* the array. However, the spread operator only works in-place, like in an argument to a function or in an array literal. The following code will not work:
|
||||
`...arr` returns an unpacked array. In other words, it spreads the array. However, the spread operator only works in-place, like in an argument to a function or in an array literal. For example:
|
||||
|
||||
```js
|
||||
const spreaded = [...arr];
|
||||
```
|
||||
|
||||
However, the following code will not work:
|
||||
|
||||
```js
|
||||
const spreaded = ...arr;
|
||||
|
||||
Reference in New Issue
Block a user