Computer >> Computer tutorials >  >> Programming >> Javascript

What is Modulus Operator (%) in JavaScript?


The Modulus operator (%) outputs the remainder of an integer division.

Example

You can try to run the following code to learn how to work with Modulus (%) operator.

<html>
   <body>
      <script>
         var a = 33;
         var b = 10;

         document.write("a % b = ");
         result = a % b;
         document.write(result);
      </script>
   </body>
</html>