Arguments Optional: Recursive function takes 2nd input

Hi! I found this solution to the Arguments Optional intermediate javascript challenge. Can someone please explain to me what’s happening in the first if statement? How does this recursive function actually take a second input? I don’t understand why the second input is passed to the anonymous function as “x” while “a” is already coded into the return statement…

  **Your code so far**

function addTogether() {
  var len = arguments.length;
  var a = arguments[0];
  var b = arguments[1];
  var isNum = function(arg) { return Number.isFinite(arg); };
  if (len === 1 && isNum(a)) {
    return function(x) {
      if (isNum(x)) {
        return a + x;
      }
    };
  }
  else if (len === 2 && isNum(a) && isNum(b)) {
    return a + b;
  }
}

  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36.

Challenge: Arguments Optional

Link to the challenge: