Skip to content
Advertisement

object destructuring: how to use intermediate nested property

JavaScript

Is there a way to get access to all three in one destructuring call? I want to avoid two calls like so:

JavaScript

Advertisement

Answer

The closest I can come up with is:

JavaScript

Though I’d use let instead, if I’m using ES6 😉

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement