/

Destructuring

javascript
js
const exampleObject = { a: { b: 'hi' } }
// Want to get both `a` and `b` as variables?
// You totally can do this in one line of destructuring.
const {
a,
a: { b }
} = exampleObject
Edit this page
Want to make your own site like this? Try gatsby-theme-code-notes by Zander Martineau.
Notes on code. My second brain, by Zander Martineau.