DEV Community

Takuya Kikuchi
Takuya Kikuchi

Posted on

Nested object and array destructuring

Destructuring on nested object? 🤔

Destructuring is commonly used, but do you know how to do destructuring nested object and array?

Can you refactor this?

Sandbox below to try it by yourself 👇
Image 2021-08-15 at 12.35.10 PM

The code taken from MDN: Destructuring assignment - JavaScript | MDN

Use nested object and array destructuring 👍

Image 2021-08-15 at 12.40.10 PM

Reference

Destructuring assignment - JavaScript | MDN

CodeSandbox

Discussion (0)