Mega Code Archive

 
Categories / JavaScript Tutorial / Operators
 

%= (Modulus Assignment)

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>