# JavaScript Modulo (%): Remainder Operator Explained

DevFeed: [JavaScript Modulo (%): Remainder Operator Explained](<https://devfeed.tech/articles/javascript-modulo-remainder-operator-explained-116067.md>)

Original publisher: [Read original article](<https://markodenic.com/javascript-modulo/>)

Author: Marko

Published: 2026-11-03T09:00:00Z

Content type: article

Language: en

Sources: [Marko Denic Blog](<https://devfeed.tech/sources/marko-denic-blog.md>)

Topics: [JavaScript](<https://devfeed.tech/topics/javascript.md>)

Tags: [array](<https://devfeed.tech/tags/array.md>), [bigint](<https://devfeed.tech/tags/bigint.md>), [calc](<https://devfeed.tech/tags/calc.md>), [clamp](<https://devfeed.tech/tags/clamp.md>), [css](<https://devfeed.tech/tags/css.md>), [dividend](<https://devfeed.tech/tags/dividend.md>), [floating-point](<https://devfeed.tech/tags/floating-point.md>), [foreach](<https://devfeed.tech/tags/foreach.md>), [function](<https://devfeed.tech/tags/function.md>), [index](<https://devfeed.tech/tags/index.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [min](<https://devfeed.tech/tags/min.md>), [minutes](<https://devfeed.tech/tags/minutes.md>), [numbers](<https://devfeed.tech/tags/numbers.md>), [operator](<https://devfeed.tech/tags/operator.md>), [python](<https://devfeed.tech/tags/python.md>), [sign](<https://devfeed.tech/tags/sign.md>), [tutorial](<https://devfeed.tech/tags/tutorial.md>)

## AI overview

JavaScript's `%` operator returns a remainder, whose sign follows the left operand; it is therefore not true modulo for negative values. The excerpt shows uses for divisibility and even/odd checks, periodic actions, wrapping array indexes, and splitting seconds into minutes and seconds. For a nonnegative modulo result, it gives `((n % m) + m) % m`. It also notes that decimal remainders can be imprecise because of floating-point representation, BigInt operands must both be BigInts, and `% 0` yields `NaN`.

## Source excerpt

How the % operator works in JavaScript: remainders, even and odd checks, why negative numbers give negative results, a true modulo function, and practical uses like wrapping indexes and time formatting.