fix(curriculum): array spread syntax example (#50416)

array literal spread syntax #50414 fixed
This commit is contained in:
Rabin Osti 2023-05-18 23:50:06 +05:45 committed by GitHub
parent 1e6b3cfa70
commit 129f629e10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;