%
gives the remainder of the division of two numbers.
Example
5 % 2 = 1 becauseUsage
Math.floor(5 / 2) = 2 (Quotient)
2 * 2 = 4
5 - 4 = 1 (Remainder)
2
.
17 % 2 = 1 (17 is Odd)Note
48 % 2 = 0 (48 is Even)
remainder
equal to the remainder of 11
divided by 3
using the remainder (%
) operator.
remainder
should be initialized
testString: assert(/var\s+?remainder/.test(code));
- text: The value of remainder
should be 2
testString: assert(remainder === 2);
- text: You should use the %
operator
testString: assert(/\s+?remainder\s*?=\s*?.*%.*;?/.test(code));
```