Tell us what’s happening:
Hi! I don’t know why my code won’t pass for addTogether(5)(7), addTogether(5) and addTogether(2)([3]).
Please help me. Thank you very much!
Explain to us what your code returns for this function call. Don’t just say “a function”. Go through your function line by line and tell us what will happen.
//This line here means if any of the provided argument is not a number, the function should return undefined.
if(num.length === 2) return num[0] + num[1];
// This line means if there isn’t any non-number argument and there are 2 arguments, which means there are 2 numbers, they return their sum
return (newNum) => addTogether(newNum, num[0]);
//This line means if the provided arguments don’t match the above 2 circumstances, which means there is only 1 number, return a function to take a new number and the new function should return the sum of the new number and the given number
}