Tell us what’s happening:
My code works, but fails the test.
Your code so far
function addTogether() {
let result = 'v';
for (let item of arguments) {
if (typeof item !== 'number') {
result = void(0);
}
}
if (result === 'v') {
if (arguments.length === 2) {
result = arguments[0] + arguments[1];
} else {
let y = arguments[0];
result = function(x) {
return y + x;
}
}
}
return result;
}
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/75.0.3770.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/arguments-optional