title: Can't Get Variable to Add Properly
body: <p>I have a variable++; in an if/else statement (it being in the else part). It's supposed to add 1 to a score of how many wrong guesses one has.
  For some reason it never adds just one, it will also add numbers ranging from 3 to 7 whenever I submit a 'guess'. Can you guys tell me if I'm looping wrong or something? Please try to explain in detail.</p>
  
  <p><strong>EDIT:</strong> I realized part of the problem. The tries++; is actually looping once for each letter [var]choice didn't match or equal. For instance if I enter "a" for "apple" tries++; will loop four times because of the four other characters. So how do I get it to only loop only once instead of adding one for each missed character?</p>
  
  <p>This is my code.</p>
  
  <pre><code>// JavaScript Document
  var words = new Array("apple","orange","banana","lime","mango","lemon","avacado","pineapple","kiwi","plum","watermelon","peach");
  var randomNum;
  var word;
  var tries = 0;
  
  $('#guess').prop('disabled', true);
  
  $(function(){
  $('#start').click(function(){
      $('#guess').prop('disabled', false);
      word = "";
      randomNum = Math.floor(Math.random() * words.length)
      for (var i =0; i &lt; words[randomNum].length; i++) {
          word += "*";
      }
      console.log(words[randomNum]);
      $('#word').html(word);
  });
  
  $('#guess').click(function guess(){
      var choice = $('#letter').val().toLowerCase();
      for (var i =0; i &lt; word.length; i++) {
          if (words[randomNum].charAt(i) == choice) {
              word = word.substr(0, i) + choice + word.substr(i + 1);
          } 
          if (words[randomNum].charAt(i) !== choice) {
              tries++;
          }
      }
  
      if (tries &lt; 7) {
          $('#tries').html(tries)
      } else if (tries &gt;= 7)
          $('#tries').html("YOU LOSE");
  
      $('#word').html(word);
  
      $('#' + choice).css("background-color", "red");
  });
  
  });
  </code></pre>