JavaScript simplifies the use of arithmetic operators as shown in this table:
Operator Sample expression Meaning -= x-= 4 x = x - 4
+= x+= 4 x = x + 4
*= x*= 4 x = x * 4
/= x/= 4 x = x / 4
%= x%= 4 x = x % 4
-- x-- postdecrement: use the value of x and then decrement by 1
-- --x predecrement: decrement by 1 and then use the value of x
++ x++ postincrement: use the value of x and then increment by 1
++ ++x preincrement: increment by 1 and the use the value of x
<!DOCTTYPE html>This figure shows the output of the above JavaScript program and how the Forloop iterates a number of times:
<!--Loop3.html -->
<html>
<head>
<title> Loop for 5 times </title>
<script >
<!--
var counter; //counter
for (counter = 1; counter <=5; ++counter) //begining of the foor loop
{
document.writeln("< p style = 'font-size: " + counter + "ex'>HTML 5 font size" + counter + "< p>");
} //end of foor
// -->
</script>
</head>
<body></body>
</html>