Destructuring
var foo = {
bar: {
bas: 123
}
};Object Destructuring
var rect = { x: 0, y: 10, width: 15, height: 20 };
// Destructuring assignment
var {x, y, width, height} = rect;
console.log(x, y, width, height); // 0,10,15,20
rect.x = 10;
({x, y, width, height} = rect); // assign to existing variables using outer parentheses
console.log(x, y, width, height); // 10,10,15,20Object Destructuring with rest
Array Destructuring
Array Destructuring with rest
Array Destructuring with ignores
JS Generation
Summary
Last updated