Thursday, November 13, 2025
HomeLanguagesJavascriptModulus(%) Arithmetic Operator in JavaScript

Modulus(%) Arithmetic Operator in JavaScript

JavaScript arithmetic modulus operator is used to return the remainder of the operands. Here also the left operator is the dividend and the right operator is the divisor.

Syntax:

a%b

Return Type: Remainder of the operands.

Example 1: In this example, we will check the remainder with Number and Infinity.

Javascript




console.log(100%23);
console.log(Infinity%20);


Output:

8
NaN

Example 2: In this example, we will use the modulus operator on the negative number and NaN 

Javascript




console.log(-100%23);
console.log(NaN%20);


Output:

-8
NaN

Supported Browsers:

  • Chrome
  • Edge
  • Firefox
  • Opera
  • Safari

We have a complete list of Javascript Arithmetic operators, to check those please go through this JavaScript Arithmetic Operators article.

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32399 POSTS0 COMMENTS
Milvus
95 POSTS0 COMMENTS
Nango Kala
6765 POSTS0 COMMENTS
Nicole Veronica
11916 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11983 POSTS0 COMMENTS
Shaida Kate Naidoo
6889 POSTS0 COMMENTS
Ted Musemwa
7141 POSTS0 COMMENTS
Thapelo Manthata
6834 POSTS0 COMMENTS
Umr Jansen
6838 POSTS0 COMMENTS