Tell us what’s happening:
Describe your issue in detail here.
Hello Friends,
Hope you are having a happy coding time, I’m trying to solve this problem but something is going wrong any advice or link I should check ?
Thanks a lot !
…
Create a function that sums two arguments together. If only one argument is provided, then return a function that expects one argument and returns the sum.
If either argument isn’t a valid number, return undefined.
**Your code so far**
function addTogether() {
let sum = 0;
if(typeof(arguments[0]) == "number" && typeof(arguments[1]) == "number"){
sum = arguments[0]+arguments[1];
}else if(typeof(arguments[0] !== "number") || typeof(arguments[1]) !== "number"){
sum = undefined;
}else{
sum = (a) => {
return (b) => {
return a+b;
}
}
}
return sum;
}
addTogether(2,3);
**Your browser information:**
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36
Challenge: Arguments Optional
Link to the challenge: