# Using remainder of division instead of division operator in FizzBuzz

I have a question about the FizzBuzz exercise under Control Loops in the JavaScript Mastery series. I did my version of the FizzBuzz function using the division operator. My version did not fully work. In the answer Mosh did he used the remainder of division operator. My question is why would we use the RoD operator instead of the division operator if they are both used to divide?

The modulo (aka remainder) operator is not used to divide, it gives the remainder after division. There is also a difference between floating point division and integer division.

For example, consider the operators applied to 5 and 3:

``````// Floating point division:
5/3 === 1.66666... // rounded to some approximation

// Integer division
Math.floor(5/3) === 1

// Modulo or remainder
5%3 === 2
``````

The answers are completely different.

Since the modulo is equal to 0 if (and only if) the dividend is evenly divisible by the divisor, we can use that to check if the number divides evenly. This is why modulo is used in the classic FizzBuzz problem.