SolarWind - 2 years ago 111

Javascript Question

What is the % operator in javascript?

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

`%`

is remainder operator. It gives the remainder after division.
^{Quoting from MDN}

The remainder operator returns the remainder left over when one operand is divided by a second operand. It always takes the sign of the dividend, not the divisor. It uses a built-in modulo function to produce the result, which is the integer remainder of dividing

`var1`

by`var2`

— for example —var1 modulo var2.There is a proposal to get an actual modulo operator in a future version of ECMAScript,

the difference being that the modulo operator result would take the sign of the divisor, not the dividend.

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**