Open ishehroze opened 3 months ago
Remember Python's deconstruction:
a, b, c = (1, 2, 3)
However, EC2015 takes it to the next level:
obj = {first: 1, last: 100}; const {first, last} = obj; console.log(first); // 1 console.log(last); // 100 const {first: f, last: l} = obj; console.log(f); // 1 console.log(l); // 100 arr = [1, 2, 3]; const [a, b, c] = arr; console.log(a); // 1 console.log(b); // 2 console.log(f); // 3
However, the most useful part is the deconstruction of function parameters, particularly with default values:
function printSomething({something='Something'}) { console.log(something); } printSomething(); printSomething('Anything');
The lesson referred doesn't require any changes to this repository
Remember Python's deconstruction:
However, EC2015 takes it to the next level:
However, the most useful part is the deconstruction of function parameters, particularly with default values: