Modulo Operation
Take an example as below.
5 % 2 => 1
This is an example of modulo operation. 5 is called dividend, 2 is called divisor and the result 1 is called remainder.
In JavaScript, we can do modulo operation as below.
> 5 % 3
2
> -5 % 3
-2
> 0 % 3
0
> 3 %...
blog.yaox023.com2 min read
trav
sr dev @ universal music, forker @ crablang
The modulo operation is definitely useful—it would be nice to see it explained in depth with some more context to accompany the code samples. It’s also worth noting that not all programming languages calculate modulo the same way, so it's important to know the quirks of the language you're using.