Computes the modulo remainder of a division.
The result will always have the sign of the divisor. This differs from the % operator in JavaScript, which is really the remainder operator.
%
the number to be divided
the number to divide by
the modulo remainder with the sign of the divisor
RangeError if divisor is zero
import { mod } from "@trashpanda001/helpers/number"mod(5, 2)// 1mod(-5, 2)// 1 .. where as -5 % 2 is -1 Copy
import { mod } from "@trashpanda001/helpers/number"mod(5, 2)// 1mod(-5, 2)// 1 .. where as -5 % 2 is -1
Computes the modulo remainder of a division.
The result will always have the sign of the divisor. This differs from the
%
operator in JavaScript, which is really the remainder operator.