Whats wrong with my code? It doesnt pass the test

Tell us what’s happening:
Describe your issue in detail here.

   **Your code so far**

function addTogether(...arg) {
if (arg.length == 0 || arg.some((e)=>{
   return isNaN(e) || typeof e !=="number" 
})) return "undefined"
 return arg.length<2? (n) => {return typeof n ==="number" && !isNaN(n)? arg[0]+n:"undefined"} :arg[0]+arg[1]
}

console.log(addTogether())
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0.

Challenge: Arguments Optional

Link to the challenge:

There is a difference between the string "undefined" and the JS data value undefined. To use the JS value of undefined, you use it without the quotes.

If I fix that (in two places), your code passes for me.

Indeed… TY so much mister :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.