Tell us what’s happening:
For some reason my function is failing the last test.
for addTogether(2)([3]), my function is returning 23 rather than undefined.
Any kind of nudge in the right direction would be greatly appreciated.
Your code so far
function addTogether(firstNum,secondNum)
{
for(var i = 0; i<arguments.length; i++)
{
// alert(typeof arguments);
if(typeof arguments[i] !== "number"){return undefined;}
}
if(arguments.length < 2)
{
return function(secondNum){return firstNum+secondNum;};
}
else
{
return firstNum+secondNum;
}
}
addTogether(2)([3]);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/arguments-optional