+ 1
Why my code doesn't work?
Why my code doesn't work? https://code.sololearn.com/W4p8LHP9fvM8/?ref=app
2 Answers
+ 4
@ValentinHacker is offtopic ;P
Your mistake is when you divide by two the 'num' variable: this give you floating result, but you're expecting integer value...
There is mainly 2 ways to fix it:
num = Math.floor(num / 2);
or :
num = (num- rem)/ 2;
+ 15
(Put a "return false" at the end of your function...)