Assignment Operator
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title></title>
- </head>
- <body>
- <script type="text/javascript">
- var a = 31;
- var c = 9;
- //Add AND
- c += a; // c = c + a; 9 + 31 = 40;
- document.write("the addition of c is :"+c+"<br>"); // document.write() use for print line.
- //Subtract ANd
- c -= a; // c = c - a; 40 - 31 = 9;
- document.write("the substraction of c is :"+c+"<br>");// <br> use for linebreake.
- //Multiply AND
- c *= a; // c = c * a; 9 * 31 = 279;
- document.write("the multiplication of c is :"+c+"<br>");
- //Division
- c /= a; // c = c / a; 279 / 31 = 9;
- document.write("the division of c is :"+c+"<br>");
- //Mod AND
- c %= a; // c = c % a; 9 % 9 = 9;
- document.write("the modulus of c is :"+c+"<br>");
- </script>
- </body>
- </html>
//Execute
//Output
/*
the addition of c is :40
the substraction of c is :9
the multiplication of c is :279
the division of c is :9
the modulus of c is :9
*/
//ThE ProFessoR