# \[solved \] Arguments Optional Help

**URL:** <https://forum.freecodecamp.org/t/solved-arguments-optional-help/79443>\
**Category:** General\
**Created:** [January 22, 2017, 9:46pm UTC](https://forum.freecodecamp.org/t/solved-arguments-optional-help/79443 "2017-01-22T21:46:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saf94](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/saf94/32/75504_2.png) [@saf94](https://forum.freecodecamp.org/u/saf94)\
**Post date:** [January 22, 2017, 9:46pm UTC](https://forum.freecodecamp.org/t/solved-arguments-optional-help/79443/1 "2017-01-22T21:46:52Z")

</div>

Hi guys. I’m really close on this one but this last part I’m getting stuck on. When i pass in the arguments as below, I think it’s converting the “3” into a number, which obviously I don’t want it to do as I want it to return undefined. How can i stop this from happening? Thanks

```
function addTogether(a,b) {
  
  var hold = 0;
  
  if (typeof(a) === "number") {
    if (arguments.length === 1) {
      return function secondOrderFunc(b) {
        if (typeof(b) === "number")
          return a + b;
        else {
          return undefined;
        }
    };
    
    } else if (arguments.length === 2) {
        return a + b; 
    }

  } else {
    return undefined;
  }
  
}

addTogether(2, "3");
```

---

<div class="post-metadata">

**Author:** ![timotheap](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/timotheap/32/26039_2.png) [@timotheap](https://forum.freecodecamp.org/u/timotheap)\
**Post date:** [January 22, 2017, 9:58pm UTC](https://forum.freecodecamp.org/t/solved-arguments-optional-help/79443/2 "2017-01-22T21:58:23Z")

</div>

> [@saf94](#):
>
> else if (arguments.length === 2) {  
> return a + b;  
> }

It looks like the problem is there, maybe you could have an `&&` to make sure a string doesn’t pass?

---

<div class="post-metadata">

**Author:** ![saf94](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/saf94/32/75504_2.png) [@saf94](https://forum.freecodecamp.org/u/saf94)\
**Post date:** [January 22, 2017, 10:10pm UTC](https://forum.freecodecamp.org/t/solved-arguments-optional-help/79443/3 "2017-01-22T22:10:55Z")

</div>

Ah of course! How silly of me, got it now thanks 🙂

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 16, 2021, 5:11pm UTC](https://forum.freecodecamp.org/t/solved-arguments-optional-help/79443/4 "2021-01-16T17:11:00Z")

</div>


