1Object Destructuring =>
2//
3 The destructuring assignment syntax is a JavaScript expression that makes it
4possible to unpack values from arrays,
5or properties from objects, into distinct variables.
6//
7example:
8const user = {
9 id: 42,
10 is_verified: true
11};
12
13const {id, is_verified} = user;
14
15console.log(id); // 42
16console.log(is_verified); // true
17
1In JavaScript, destructuring is when you decompose the properties of an object or the indexes of an array to separate them to create specific variables. This does not mean that these separated objects or arrays can never be used again in the program.
1Object Destructuring =>
2//
3 The destructuring assignment syntax is a JavaScript expression that makes it
4possible to unpack values from arrays,
5or properties from objects, into distinct variables.
6//
7example:
8const user = {
9 id: 42,
10 is_verified: true
11};
12
13const {id, is_verified} = user;
14
15console.log(id); // 42
16console.log(is_verified); // true