function add() {
  //return false;
  if(typeof arguments[0] !== "number" || arguments.length > 1 && typeof arguments[1] !== "number"){
    return undefined;
  }
  if(arguments.length == 1){
    var arg0 = arguments[0];
    return function(num){
      if(typeof num !== "number"){
        return undefined;
      }
      return arg0 + num;
    };
  }else{
    return arguments[0] + arguments[1];
  }
  
}

add(2,3);

  

posted on 2016-12-22 15:29  梦如影  阅读(146)  评论(0编辑  收藏  举报