Tell us what’s happening:
Not passing the 4th test
addTogether(2, “3”) should return undefined.
And this line of code never gets excuted, not sure why.
if(typeof y !== "number") return undefined;
Your code so far
function addTogether(x, y) {
if(typeof x !== "number") return undefined;
if(arguments.length === 2)
return x + y;
return function(y) {
if(typeof y !== "number") return undefined;
return x + y;
}
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/67.0.3396.99 Safari/537.36
.
Link to the challenge: