Tell us what’s happening:
The code seems to work outside of the last check, when the second arg is a number inside an array. The confusing part is that with those args (2,[3]), the console.log directly before ‘return undefined’ is functioning as I would expect it to, but undefined isn’t being returned.
**Your code so far**
function addTogether() {
let len = Array.from(arguments);
console.log(len);
//let len = Object.values(arguments);
console.log(len.length);
console.log(len.every(x => typeof x === 'number'));
if(len.every(x => typeof x === 'number')){
switch(len.length){
case 2:
console.log('adding two');
return len[0] + len[1];
case 1:
return function(arg){
return len[0] + arg;
}
}
}
else{
console.log('returning undefined');
return undefined;
}
}
addTogether(2,[3]);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0
Challenge: Arguments Optional
Link to the challenge: