js modulo negative code example
Example 1: how to turn a number negative in javascript
-Math.abs(num); // "-" before Math.abs()
Example 2: js modulo negative
// The JS % operater is REMAINDER not MODULO
// For modulo behaviour use
function mod(n, m) {
return ((n % m) + m) % m;
}