Destructuring Assignment
Multiple Choice Easy
Question
After const {a, b} = {a:1, b:2, c:3}; what is a?
Hint
Destructuring extracts properties by name.
Explanation
Object destructuring extracts properties by name. const {a, b} = {a:1, b:2, c:3} creates variables a=1 and b=2. The property c is ignored because it is not in the destructuring pattern. You can also rename: const {a: x} = obj makes x = obj.a.
Related Resources
Related Lessons
- Objects
Learn how objects work.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.