title: Add a variable to textfield JavaScript
body: <p>For my Javascript assignment I have to make a slot machine.</p>
  
  <p>The one part I can't get is adding my totalCredits Variable to my textfield.</p>
  
  <p>It just puts the variable beside the credits instead of adding them. (want to add 30 + 2 but I get 302)</p>
  
  <p>I have tried parseFloat and parseInt both give me "ReferenceError: invalid assignment left-hand side" </p>
  
  <p>This is the function</p>
  
  <pre><code>    function checkForWin() {
  
       if (bet1 == true &amp;&amp; symbols[rng1].color == symbols[rng2].color &amp;&amp; symbols[rng2].color == 
          symbols[rng3].color &amp;&amp; symbols[rng1].color == symbols[rng3].color) {
  
  document.getElementById("message").innerHTML = "Same Color You Win 2 Credits";
              totalCredits = totalCredits + 2;
  
              parseInt(document.getElementById('credits').value) = totalCredits;
              console.log(totalCredits);
  
       };
  </code></pre>
  
  <p>Code : <a href="https://jsfiddle.net/Socha/ndLn73bw/" rel="nofollow">https://jsfiddle.net/Socha/ndLn73bw/</a></p>