Modulo (%)
Try it
Der Modulo-Operator (%) gibt den Restwert zurück, der übrig bleibt wenn ein Operand durch einen anderen geteilt wird. Das Vorzeichen ergibt sich aus der Wahl der Quotienten.
Syntax
Operator: var1 % var2
Examples
Remainder with positive dividend
12 % 5 // 2
1 % -2 // 1
1 % 2 // 1
2 % 3 // 2
5.5 % 2 // 1.5
Remainder with negative dividend
-12 % 5 // -2
-1 % 2 // -1
-4 % 2 // -0
Remainder with NaN
NaN % 2 // NaN
Specifications
Browser compatibility
BCD tables only load in the browser