when I run this code on Atom, I get the correct answers in all cases. When I run it on FCC, the second test fails: AddTogether(2) (3).
Can you help?
thanks.
function addTogether() {
var args=Array.prototype.slice.call(arguments);
//console.log("args length=", args.length);
//console.log(args[0]);
if (args.length>2) {
return undefined;
}
for (i=0;i<args.length;i++) {
//console.log("for loop");
if (typeof args[i] == "string") {
//console.log("here");
return undefined;
} else {
//return console.log( "didn't work",(args[i] != args[i]));
}
}
if (typeof args[0]=="string") {
// console.log("Single argument is not a number");
return undefined;
}
if (args.length==2) {
//alert(args);
//console.log(args[0]+args[1]);
return args[0] + args[1];
} else {
console.log("right place");
return function(y) {
var sumTwoAnd= args[0]+y;
console.log(sumTwoAnd);
//console.log(sumTwoAnd);
};
}
// return false;
}
addTogether(2) (3);