DEV Community

Discussion on: Javascript: Destructure Objects and Arrays for Cleaner Code

Collapse
 
abdurrkhalid333 profile image
Abdur Rehman Khalid

This is a very beautiful article written to explain a very beautiful use of one of the most powerful features of modern JavaScript. But there are somethings that you have missed and I would like to make you aware of those things as well.

Missing a Value

If you want to miss the value at a certain index you can only place a simple "," there to skip that value and work with the rest.
To Miss the Value

Writing the Default Value

If there is no value being passed then you can also assign the default value as well.
Adding Default Value

Collapse
 
antdp425 profile image
Anthony DiPietrantonio

Yes, great comment -- thanks for adding it 😎

I originally chose to leave these out just so that I could cover the basics of the feature