Unpack values from arrays and objects into neat, individual variables — in a single line.




Here's a pattern I used to write all the time before I learned about destructuring:



const user = {
name: "Pratham",
age: 22,
city: "Delhi",
};

const name = user.name;
const age = user.age;
const city = user.city;

console.log(name); //...