Why doesn't it pass the test? Intermediate Algorithm Scripting: Arguments Optional

Hey, can someone tell me what is wrong with this code please?
It doesn’t pass the test because “addTogether(2)([3]) should return undefined.”
It does return undefined, doesn’t it?

function addTogether() {
  if(typeof arguments[1] !== 'number'){
    return undefined;
  } return arguments[0] + arguments[1];
if(typeof arguments[0] == 'number'){
  let a = arguments[0];
  return function(num){
    return a + num;

console.log(addTogether(2,[3])); //returns undefined

Challenge: Arguments Optional

Link to the challenge:


This is not what the test calls. The test calls addTogether(2)([3]), which returns 23 with your code. :slight_smile:

1 Like

Omg, silly me :crazy_face:
Thank you!!!

1 Like