JavaScriptEasy
Explain the concept of destructuring assignment for objects and arrays
By FrontendPro Editorial Team Updated 8/8/2026
#JavaScript
Answer
Destructuring assignment is a syntax in JavaScript that allows you to unpack values from arrays or properties from objects into distinct variables. For arrays, you use square brackets, and for objects, you use curly braces. For example:
js
// Array destructuring
const [a, b] = [1, 2];
// Object destructuring
const { name, age } = { name: "John", age: 30 };
