Arguments Optional help

I seem to have solved the condition of addTogether(5)(7) which I struggled to fully understand, but the last conditional test of addTogether(2)([3]) is giving me an output of 23?



**Your code so far**
      
```js

function addTogether() {
if (arguments.length === 1 && typeof arguments[0] === "number") {
  console.log(addTogether())
  
  let y = arguments[0];
  return function(x) {
    return y + x

  }

} else if (arguments.length === 2 && typeof arguments[0] == "number" && typeof arguments[1] == "number") {
 let result = arguments[0] + arguments[1];
 return result;

} else {
  return undefined
}


}

addTogether(2)([3]);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36.

Challenge: Arguments Optional

Link to the challenge:

this one execute there,
you don’t check the types, and 2 + [3] involves type coercion, makinn it string concatenation

also, not call the function inside itself

like this

1 Like

Solved, thanks @ILM! :smiley: