Es6函数无传参的自定义报警程序

报警函数,没有值传入就执行报警信息
function throwIfMissing() {
  throw new Error('Missing parameter');
}

function foo(mustBeProvided = throwIfMissing()) {
  return mustBeProvided;
}

foo()

 

posted on 2022-03-09 09:30  蛙酷  阅读(32)  评论(0)    收藏  举报

导航