Name

% — NN 2 IE J1 ECMA 1

Synopsis

The modulus operator. This operator divides the number to the left of the operator by the number to the right. If a remainder exists after the division, the expression evaluates to that remainder as an integer. If there is no remainder, the returned value is zero. Both operands must be numbers. An expression with this operator evaluates to a number. Even if you aren’t interested in the remainder value, this operator is a quick way to find out if two values are evenly divisible.

Example

if ((dayCount % 7) > 0) {
    ...
}

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.