modulus % javasc code example
Example 1: modulus js
console.log(10%3);
//returns 1 (the remainder of 10/3)
Example 2: how to find remainder in javascript
var myNum = 10 / 4; // 2.5
var fraction = myNum % 1; // 0.5
myNum = -20 / 7; // -2.857142857142857
fraction = myNum % 1; // -0.857142857142857