foo()Error: Missing parameter
foo(123)Ok
| /** | |
| * Called if a parameter is missing and | |
| * the default value is evaluated. | |
| */ | |
| function mandatory() { | |
| throw new Error('Missing parameter'); | |
| } | |
| function foo(mustBeProvided = mandatory()) { | |
| return mustBeProvided; | |
| } |