update an object value with destructuring javascript code example
Example 1: array destructuring methods parameters
function foo([a, b]) {
console.log(`param1: ${a}, param2: ${b}`);
}
Example 2: object destructuring default value
let a, b;
[a=5, b=7] = [1];
console.log(a); // 1
console.log(b); // 7