Get positive modulus from number - Node.js Number

Node.js examples for Number:Algorithm

Description

Get positive modulus from number

Demo Code


Number.prototype.mod = function(n) {
  return ((this%n)+n)%n;
}

Related Tutorials