Question · JavaScript and TypeScript course · Module 2: Functions, Arrays and Objects
Object Destructuring - Basics
What does the expression const { name, weight } = dinosaur do?
Answer options
- Creates a new object with name and weight properties
- Extracts name and weight properties from the dinosaur object into separate variables
- Removes name and weight properties from the dinosaur object
- Adds name and weight properties to the dinosaur object
Show the answer
Correct answer:
- Extracts name and weight properties from the dinosaur object into separate variables