Extract members with destructuring

Destructuring an object lets you create new variables from an existing object.

The syntax starts by using the curly bracket and the name of the destination variable. You can use many variables separated by commas. The name of the variable must be the name of the members you want to extract from the object.

Once the member selection is made, you need to close the curly bracket, use the equal sign, and write the name of the variable you want to destructure. In this scenario, like any variable, the use of let or const is used before starting.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy