Introduction
If you’ve ever written something like const first = arr[0]; and thought "there's gotta be a cleaner way,” good news, there is, and it’s called destructuring.
What’s Destructuring?
Destructuring is just a fancy term for pulling values out of arrays or objects and sticking them into variables, all in one tidy line of code.
Destructuring Arrays
Skip Values
Set Defaults
Destructuring Objects
Rename While You’re At It
Give It a Default
Destructuring in Function Parameters
Quick Cheatsheet
Conclusion
Destructuring is one of those features that might look “meh” at first, but once you start using it, you’ll never want to go back.