Object Destructuring In Javascript
Object destructuring is a convenient way to extract multiple values from objects
and arrays. There are some handy ways to deconstruct an object:
You can alias the property to a different variable, or just use the provided
object property:
You can also just pluck the values you want to from an array or an object:
When you deconstruct an object it coerces the source to an object before
accessing it which means you can access properties of an object
You can also provide default values in object patterns:
You can skip items when deconstructing as well:
Let’s cover nested destructuring:
Read more about it here
Instagram Post