A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/modulus-arithmetic-operator-in-javascript/ below:

Modulus(%) Arithmetic Operator in JavaScript

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.

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:



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4