Account
Categories

Modulus Operator


You use the modulus operator (%) in a webpage for mathematical calculation. It helps in finding the remainder of two values (numbers), which are also called operands, and together with the percent sign (%) they perform the modulus operation.

Syntax:

let result = left_operand % right_operand;

Example:

let a = 10;
let b = 3;
let mod = a % b;
console.log("The modulus is: " + mod);

Output: