Tell us what’s happening:
What is wrong with this? It logs into my browser console "undefined just fine. But it won’t pass fcc test 4
Your code so far
function addTogether(){
var x = arguments[0];
if( typeof arguments[1] == 'number' && typeof arguments[0] == 'number' ){
var y = arguments[1] + arguments[0];
return y;
}else{
if( typeof arguments[0] == 'number' ){
return function add(a){
if( typeof a == 'number' ){
return a+x;
}else{
console.log(undefined);
return undefined;
}
};
}
}
}
addTogether(2)('3');
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36
.
Link to the challenge:
https://www.freecodecamp.org/challenges/arguments-optional