function throwError(propName) {
throw new Error(`'${propName}' is required`)
}
function doSomething(someArg = throwError("someArg")) {
return someArg;
}
doSomething();
// Uncaught Error: someArg is required
function throwError(propName) {
throw new Error(`'${propName}' is required`)
}
function doSomething(someArg = throwError("someArg")) {
return someArg;
}
doSomething();
// Uncaught Error: someArg is required