Arguments Optional is going to kill me

Tell us what’s happening:

I have no idea where to go from here. This works with the all but the double parentheses arguments.

Your code so far

function addTogether() {
  const args = Array.from(arguments);
  return args.every((x, y, z) => typeof x === "number" && z.length === 2) 
  ? args.reduce((a, b) => a + b) 
  : undefined;


Your browser information:

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

Link to the challenge:

I assume you are failing the test case of addTogether(2)(3) and addTogether(2)([3]).

Remember, if there is only one argument provided, you should return a function that expects one argument and returns the sum.

The only call to the addTogether function is represented by addTogether(2). The (3) represents a call to the function you should be returning from the addTogether function. Why? Because 2 is a number and it is a single argument.


Thanks. I was not reading the instructions properly.

Your awesome.