What is Modulus Operator (%) in JavaScript?

JavascriptWeb DevelopmentFront End Technology

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>
raja
Published on 19-Jan-2018 05:37:29
Advertisements