Basic code is wrong? Why?


I’m trying to solve this basic Kata but for some reason it’s wrong? Any ideas? I’d appreciate some help as I’m sure my thinking is right, it’s just my code that might be wrong?



Take a look at this line.

if (number % a && number % b)

You’re on the right track by using the modulo operator to determine if number can be evenly divided by a and b. However, you’re missing one bit of code. Take a closer look at that line and see if you can figure out what is wrong.

What happens when a number can be easily divided by another? What is the remainder of that operation? 0. Checking if num1 % num2 === 0 will determine if a number is evenly divisible by another.

Ahhhhhh thank you so much for this!

1 Like