Destructuring

Learn the shorthand syntax for unpacking values from arrays and objects into individual variables.

Step 1 of 5

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.

Think of it this way: Destructuring is like opening a gift box and immediately putting each item where it belongs — instead of reaching into the box every time you need something. You unpack once, and everything has its own named spot.
Learn more on MDN
JAVASCRIPTREAD ONLY
CONSOLE
Click "Run" to execute your code...