floor division javascript code example
Example 1: divide intagers javascript
var quotient = Math.floor(y/x);
var remainder = y % x;
Example 2: javascript division get remainder
var y=11;
var x=4;
var quotient = Math.floor(y/x); //2
var remainder = y % x; //3
Example 3: math.floor js
console.log(Math.floor(5.95));
// expected output: 5
console.log(Math.floor(5.05));
// expected output: 5
console.log(Math.floor(5));
// expected output: 5
console.log(Math.floor(-5.05));
// expected output: -6
Example 4: javascript round down
Math.floor(x);