Operators
Remainder operator (%)
The remainder operator computes the remainder after truncating the quotient toward zero. For finite Number operands a nonzero remainder has the dividend's sign. It is not a percentage or generally a mathematical modulo operation. BigInt division by zero throws RangeError.
Formal Syntax & Structure
javascript syntaxjavascript
left % rightParameters & Attributes
| Name | Type | Description |
|---|---|---|
| left | expression | Dividend. |
| right | expression | Divisor. |
Return Value
number | bigint
Remainder in the applicable numeric type.
Working Example
Example Snippetjavascript
console.log(17 % 5);console.log(-17 % 5);