js函数的默认参数

function f(flag, start, end, msg){

  flag = flag == false ? flag true;

  start = start || null;

  start = arguments[1] ? arguments[1] : null;

  end = end || null;

  end = arguments[2] ? arguments[2] : null;

  msg = msg || null;

  msg = arguments[3] ? arguments[3] : null;

}

posted @ 2018-12-25 15:17  y-xs  阅读(782)  评论(0编辑  收藏  举报