modulo
The modulo() method returns the remainder of the Euclidean division of two numbers. This operation is useful to determine parity, create circular rotations, or handle pagination.
Interactive example
Syntax
Classic signature
typescript
function modulo<
GenericInput extends number
>(
input: GenericInput,
divisor: number
): numberCurried signature
typescript
function modulo<
GenericInput extends number
>(
divisor: number
): (input: GenericInput) => numberParameters
input: The dividend (the number to divide, classic signature only).divisor: The divisor (the number to divide by).
Return value
returns the remainder of the Euclidean division of input by divisor. The result has the same sign as the dividend (input % divisor).
