#parameter-destructuring
Read more stories on Hashnode
Articles with this tag
Below is an example. const obj1 = {}; const obj2 = { k: 2 }; function fn({ k = 1 }) { console.log(k); } fn(obj1); // 1 fn(obj2); // 2