Argument optional

Tell us what’s happening:

return function section didn't pass test i need to know mistakes in code..

think your for your help

Your code so far


function addTogether() {
 var args=[...arguments]

 for(var i in args){
 if(typeof(args[i])!="number"){
  return undefined
 }
 }

 if(args.lengh=2){
  return args.reduce((a,b)=>a+b)

  }
else if(args.lengh=1){

    return function (num) {
      if(typeof(num)!="number"){
return undefined;
      }else{
return args+num
      }
 }

    }
      }
        

 
 
 
 


 



addTogether(2,3);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; rv:81.0) Gecko/20100101 Firefox/81.0.

Challenge: Arguments Optional

Link to the challenge:

1 Like

Start with spelling errors - arguments.lengh is not the same as arguments.length.