Challenge: Arguments Optional : AddTogether(2)([3])

Challenge: Arguments Optional : AddTogether(2)([3])
0.0 0

#1

One test case fails for my code. Kindly let me know why?
It returns ‘undefined’ (which is expected output), still the case fails.

function addTogether(x) {
  if (typeof(x) !== 'number')
        return undefined;
  var args = Array.from(arguments);  
  
  if(args.length > 1)
  { 
    if (typeof args[1] !== 'number')
              return undefined;
    else
        return x + args[1];    
  }
  else
    return function(y){
        return x+y;
      };       
}


addTogether(2,[3]);

#2

I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.


#3

you have addTogether(2,[3]); which returns undefined … but it should be addToghether(2)([3]) which in your case returns 23