divide in javascript code example
Example 1: divide intagers javascript
var quotient = Math.floor(y/x);
var remainder = y % x;
Example 2: javascript 1 + "1"
console.log(10+"1");
console.log(10-"1");
Example 3: js modulo
function mod(n, m) {
return ((n % m) + m) % m;
}
Example 4: modulus js
const tableNumbers = [5, 14, 7, 10, 20, 11, 12, 15, 3]
for (let i =0; i < tableNumbers.length; i++) {
if (tableNumbers[i] % 2 === 0) {
console.log(tableNumbers[i])
}
}
Example 5: js calculate
answer_Add = 5 + 1;
answer_Sub = 5 - 1;
answer_Multi = 5 * 5;
answer_Divi = 10 / 2;
Total = answer_Add + answer_Sub + answer_Multi + answer_Divi;
Example 6: modulus js
console.log(10%3);