How Can I Use Modulo Operator (%) in Javascript? [Duplicate]

How Can I Use Modulo Operator (%) in Javascript? [Duplicate]

How can I use modulo operator (%) in calculation of numbers for JavaScript projects?

0

2 Answers

It's the remainder operator and is used to get the remainder after integer division. Lots of languages have it. For example:

10 % 3 // = 1 ; because 3 * 3 gets you 9, and 10 - 9 is 1.

Apparently it is not the same as the modulo operator entirely.

9

That would be the modulo operator, which produces the remainder of the division of two numbers.

2
Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.