js divide code example
Example 1: divide intagers javascript
var quotient = Math.floor(y/x);
var remainder = y % x;
Example 2: js modulo
// The JS % operater is REMAINDER not MODULO
// For modulo behaviour use
function mod(n, m) {
return ((n % m) + m) % m;
}
Example 3: modulus js
console.log(10%3);
//returns 1 (the remainder of 10/3)