ECMAScript is always adding new features that make our code more powerful. I even started a discussion about people's favorites.
...
For further actions, you may consider blocking this person and/or reporting abuse
There is one more use case to destruct dynamically. Also resting!
I have written an article on it here: dev.to/mzanggl/let--key-id--0-rest...
Awesome!
The first example of Array destructuring isn't a valid array, close the object:
Destructuring is good for readability.
Oops, this is what I get for typing directly in the article! I’ll make that fix.
In the array above you could:
Yup! And that’s similar to the promise.all example.
You can also pass default values in case the property is not there:
Great addition!
When I first started to learn destructuring I was very confused. Once I realized it was more like "back-ward assignment" I figured it out. Now I love using it!
Destructuring for the win!
I think of it like diving in a level deeper. You use bracket types depending on what type of data structure you’re trying to dive into.
Love that you love it now!
Nice, learned a new trick from this :)
Awesome!
excellent
Great information, I recently started learning ES2015 +, and destructuring is confusing for me. Thank you.
So glad it was helpful!
You can also set an alias to what you're destructuring!
Definitely! It's in that last example as well :)