/

HTML / CSS / JavaScript Tutorial

JavaScript Operator: modulus

[this page | pdf | back links]

In JavaScript, the % operator is the (binary) arithmetic operator for modulus (i.e. division remainder).

 

For example, if x is 9 then y = x % 4 results in y becoming 1.

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript Operators


Desktop view | Switch to Mobile