- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Destructuring
JavaScript Objects
JavaScript Destructuring
JavaScript destructuring pulls values out of objects and arrays into their own variables.
It replaces several lines of assignment with one.
It works with both objects and arrays, using braces or brackets.
Example
Example
javascript
const person = { name: "Ada", age: 36 };
const { name, age } = person;
console.log(name + " is " + age);Two variables were created in one line.
