%= (Modulus Assignment) : Mod « Operators « JavaScript Tutorial






The modulus assignment operator divides the value stored in the left variable by the right value. If value is a string, an attempt is made to convert the string to a number before performing the modulus and assignment.

<html>
     <script language="JavaScript">
    <!--
    answer = 3;
    answer %= 17;
    document.write("answer = ",answer);
    -->
    </script>
</html>








2.12.Mod
2.12.1.Modulus (%)
2.12.2.Mod operator in action
2.12.3.%= (Modulus Assignment)