VOOZH about

URL: https://www.geeksforgeeks.org/javascript/modulus-arithmetic-operator-in-javascript/

⇱ Modulus(%) Arithmetic Operator in JavaScript - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Modulus(%) Arithmetic Operator in JavaScript

Last Updated : 23 Jul, 2025

The modulus (%) arithmetic operator in JavaScript returns the remainder after dividing one number by another. It is used for tasks like determining even or odd numbers, cycling through values within a range, and managing periodic events in programming.

Syntax:

a%b

Return Type: Remainder of the operands.

Example 1: We will check the remainder with Number and Infinity in this example.

Output:

8
NaN

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

Output:

-8
NaN

Supported Browsers:

Comment
Article Tags: