Update ES6 array destructuring (#31017)

This commit is contained in:
MariusTv
2019-02-18 00:37:56 +02:00
committed by Randell Dawson
parent c2e6329296
commit d6fa57cd2f

View File

@ -32,6 +32,15 @@ console.log(firstName, lastName); // John Smith
The examples above show the benefit of using the ES6 Destructuring Assignment. The examples above show the benefit of using the ES6 Destructuring Assignment.
You can skip some values by putting comma
```javascript
const address = ['Rue Cler', 'Paris', 'France'];
const [street, , country] = address;
or
const [street] = address;
```
You can also use Destructuring on objects using a similar syntax You can also use Destructuring on objects using a similar syntax
```js ```js