Matt Smith with wonderfully straightforward writing on why default parameters for functions are a good idea. I like the tip where you can still do it with an object-style param.
function createUser({ name = 'Anonymous', age = 24 } = {}) {
console.log(`${name} is ${age} years old.`);
}
createUser(); // Anonymous is 24 years old.Code language: JavaScript (javascript)