Destructuring Objects to Extract Properties in Javascript


Unpack properties from objects into distinct variables.

Source Code

let person = {name: "John", age: 30};
let {name, age} = person;
console.log(name); // "John"
console.log(age); // 30
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments