Tell us what’s happening:
So I’m having trouble understanding this one. I don’t know what it wants exactly when passed only one arguments like the test case for addTogether(5) just says to return a function. I also don’t get how to grab the second number for cases like addTogether(5)(7) since when I check arguments only the 5 is registered. Anyway I’m just so confused with this right now so any advice on what I may be overlooking or not looking at would be amazing.
Your code so far
function addTogether() {
for (args in arguments.length){
if (!typeof Number(arguments[args])){
return undefined;
} else if (arguments.length == 2){
return (arguments[0] + arguments[1]);
} else if (arguments.length == 1) {
var sumTwoAnd = addTogether(arguments[args]);
return sumTwoAnd;
}
}
}
addTogether(2,3);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0
Challenge: Intermediate Algorithm Scripting - Arguments Optional
Link to the challenge: