JavaScript – Modulus (%)

JavaScript Modulus (%) Arithmetic Operator is used to find the remainder of division operation of two numbers, and return the result.

Modulus Operator Symbol

The symbol used for Modulus Operator is %.

ADVERTISEMENT

Syntax

The syntax to use Modulus Operator with operands is

operand1 % operand2

Examples

In the following example, we take two numeric values and find the remainder of their division operation using Modulus (%) Operator.

index.html

In the following example, we take two numeric values in exponential notation and find the remainder of their division using Modulus (%) Operator.

index.html

Conclusion

In this JavaScript Tutorial, we learned about Arithmetic Modulus Operator, its syntax, and usage with examples.