Es6函数无传参的自定义报警程序
报警函数,没有值传入就执行报警信息 function throwIfMissing() { throw new Error('Missing parameter'); } function foo(mustBeProvided = throwIfMissing()) { return mustBeProvided; } foo()
报警函数,没有值传入就执行报警信息 function throwIfMissing() { throw new Error('Missing parameter'); } function foo(mustBeProvided = throwIfMissing()) { return mustBeProvided; } foo()