Addition Assignment Operator (+=) in JavaScript



It adds the right operand to the left operand and assigns the result to the left operand.

Example

You can try to run the following code to learn how to work with Addition Assignment Operator −

<html>
   <body>
      <script>
         var a = 33;
         var b = 10;

         document.write("Value of a => (a += b) => ");
         result = (a += b);
         document.write(result);
         document.write(linebreak);
      </script>
   </body>
</html>
Updated on: 2020-06-13T08:19:32+05:30

191 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements