Destructuring
Learn the shorthand syntax for unpacking values from arrays and objects into individual variables.
Unpacking values without the repetition
Imagine you have a user object and you need to use the name, age, and email in several places. Without destructuring, you'd write:
``` let name = user.name; let age = user.age; let email = user.email; ```
That's a lot of repetition — the word `user` appears in every line. Destructuring is a shorthand that lets you unpack values from objects (or arrays) into variables in a single, clean statement. It doesn't add new functionality — everything you can do with destructuring, you could do the long way. But it makes your code significantly shorter and easier to read.
Destructuring was introduced in ES6 (2015) and is now used everywhere in modern JavaScript. You'll see it in function parameters, import statements, and virtually every codebase.