Wolfram defines the modulo operation as "m mod n is the remainder on division of m by n. The sign of m mod n for real m, n is always the same sign of n."
Python has a true modulo operator.
-5 % 2
# => 1
5 % -2
# => -1
JavaScript does not have a modulo operator. According to the ECMAScript Specification "The % MultiplicativeOperator yields the remainder of its operands from an implied division; the left operand is the dividend and the right operand is the divisor."
Most importantly "The sign of the result equals the sign of the dividend."
JavaScript has a remainder operator, not a modulo operator.
-5 % 2
// => -1
5 % -2
// => 1