1({ a, b } = { a: 10, b: 20 });
2console.log(a); // 10
3console.log(b); // 20
4
5
6// Stage 4(finished) proposal
7({a, b, ...rest} = {a: 10, b: 20, c: 30, d: 40});
8console.log(a); // 10
9console.log(b); // 20
10console.log(rest); // {c: 30, d: 40}
11
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