Arguments Optional- Need Help

Tell us what’s happening:

What am i doing wrong here?

Your code so far

function addTogether(a, b) {
  if (a === parseInt(a) && b === parseInt(b)) {

    return a + b;

  else if (b == undefined) {
    return function sumtwoAnd(c) {
      return a + c;



Your browser information:

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

Link to the challenge:

Instead of returning another function when one of arguments is invalid, you should just return undefined.

You are returning functions even though arguments aren’t valid.

The typeof operator is very useful in this challenge. See for more.

Here is what I could come up with.
function addTogether() {
var arg = […arguments]
var a = arguments[0];
var b = arguments[1];

if (arg.length === 2){
while (typeof a === ‘number’ && typeof b === ‘number’){

return a + b

else if (typeof a !== ‘number’){
return undefined

return function(b) {
  if(typeof b === 'number' && typeof a === 'number')
    return a + b;