Skip to main content

//Assignment Operator

Assignment Operator 


  1.  <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <script type="text/javascript">

  9. var a = 31;
  10. var c = 9;

  11. //Add AND 
  12. c += a; // c = c + a; 9 + 31 = 40;
  13. document.write("the addition of c is :"+c+"<br>"); // document.write() use for print line.

  14. //Subtract ANd
  15. c -= a; // c = c - a; 40 - 31 = 9;
  16.  document.write("the substraction of c is :"+c+"<br>");// <br> use for linebreake.

  17. //Multiply AND
  18. c *= a; // c = c * a; 9 * 31 = 279;
  19.  document.write("the multiplication of c is :"+c+"<br>");

  20. //Division
  21. c /= a; // c = c / a; 279 / 31 = 9;
  22.  document.write("the division of c is :"+c+"<br>");

  23. //Mod AND
  24. c %= a; // c = c % a; 9 % 9 = 9;
  25.  document.write("the modulus of c is :"+c+"<br>");

  26. </script>
  27. </body>
  28. </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