function example({ arg1 = 1, arg2 = 2, arg3 = 3 } = {}) {
return { arg1, arg2, arg3 };
}
function problem({failure = true}) {
return failure;
}
problem(); //TypeError: Cannot read property 'failure' of undefined
example({ arg2: 4, arg1: 2 }); // { arg1: 2, arg2: 4, arg3: 3 }
example(); // { arg1: 1, arg2: 2, arg3: 3 }