Provide default values in destructuring patterns. They apply when the property is undefined.
const { name, role = "user" } = { name: "Alice" };
console.log(role); // "user"
function config({ timeout = 1000 } = {}) {
console.log(timeout);
}
The = {} handles when no object is passed at all.