1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| const [a, b] = array; const [a, , b] = array; const [a = aDefault, b] = array; const [a, b, ...rest] = array; const [a, , b, ...rest] = array; const [a, b, ...{ pop, push }] = array; const [a, b, ...[c, d]] = array;
const { a, b } = obj; const { a: a1, b: b1 } = obj; const { a: a1 = aDefault, b = bDefault } = obj; const { a, b, ...rest } = obj; const { a: a1, b: b1, ...rest } = obj; const { [key]: a } = obj;
let a, b, a1, b1, c, d, rest, pop, push; [a, b] = array; [a, , b] = array; [a = aDefault, b] = array; [a, b, ...rest] = array; [a, , b, ...rest] = array; [a, b, ...{ pop, push }] = array; [a, b, ...[c, d]] = array;
({ a, b } = obj); ({ a: a1, b: b1 } = obj); ({ a: a1 = aDefault, b = bDefault } = obj); ({ a, b, ...rest } = obj); ({ a: a1, b: b1, ...rest } = obj);
|