Computer >> Computer tutorials >  >> Programming >> Javascript

What is Assignment Operator (=) in JavaScript?


It assigns values from the right side operand to the left side operand. For example, C = A + B will assign the value of A + B into C.

Example

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

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

         document.write("Value of a => (a = b) => ");
         result =(a = b);
         document.write(result);
      </script>
   </body>
</html>