Ad
  • Default User Avatar

    same here man

  • Custom User Avatar

    That's not how else ifs work. Once one if is satisfied, it breaks out of the else if chain. By your logic, 15 would actually be added thrice: 15 % 3 == 0 and 15 % 5 == 0 so that will trigger the first one, then the second else if will trigger and so will the third.

    The test case implies there is an array being passed, yet you say that number is not an array.

    Edit: Also, you are simply console.log(abc) rather than return abc, might that be the issue?

  • Custom User Avatar

    The same happened to me but I fixed it by removing some print statements. Just in case anyone else has this issue.

  • Custom User Avatar

    If it keeps happening you might have either allocated an array too big, or your code is too slow.