Arguments Optional solution

Arguments Optional solution
0.0 0

#1
  if (arguments.length===2 &&typeof a==='number'&&typeof b==='number') {
    return a+b;
  }
 else if (arguments.length===1 && typeof a==='number') {
     var addByX=addTogether.bind(this,a);
     return addByX;
  } 
}

Curious is this solution bad? I checked some other people’s solutions on forums and I noticed that they tend to be wordier with their solutions. I figured since a function call that doesn’t meet these standards would just return undefined that I didn’t need to specify it. I actually only just learned about bind a few hours ago due to Understanding the Weird Parts.


#2

No, that looks great, bind is really useful for partial application, that’s a good use of it