title: Javascript concatenate + and assign +=?
body: <p>I'm reading a book on Javascript I've got to a confusing part regarding assignment operators and concatenation. Please see below code</p>
  
  <pre><code>var msg = 'JavaScript'; msg += ' Code'; //Concatenate
  var intA = 8; intA -= 4; //Subtract and assign
  var intB = 24; intB *= intA; //Multiply and assign
  
  var str = 'Add &amp; assign string: ' + msg;
      str += '&lt;br&gt;Multiply &amp; assign: ' + initB;
  </code></pre>
  
  <p>I get that the <code>+=</code> operator, when dealing with strings concatenates the two operands and when dealing with numbers they add the values of the operands and reassign to the computed value to first operand.</p>
  
  <p>I also get that <code>str</code> is being initialised as <code>'Add &amp; assign string ' + msg;</code> and then appended with another string and a variable.</p>
  
  <p>But why would you not just write the below in the example of the <code>str</code> variable? </p>
  
  <pre><code>var str = 'Add &amp; assign string ' + msg + '&lt;br&gt;Multiply &amp; assign: ' + initB;
  </code></pre>
  
  <p>Am I misunderstanding a subtle difference between + and += , or are they the same thing in this use case?</p>