Today I Learned

hashrocket A Hashrocket project

Destructuring Assignment in Javascript

Javascript offers desctructuring assignment for array values and object properties. The syntax works like this:

// First we need an object to refer to
const pizza =  {
    crust: "thin", 
    topping: "pepperoni", 
    deliveryDriver: "Jack"

//Then we can use a destructuring assignment
const {crust} = pizza

// expected output: thin

Very handy

Read more here

See More #javascript TILs
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.