title: JavaScript - Unexpected identifier for loop
body: <p>I am trying to write a kind of brute force script in javascript!
  This is what I have so far:</p>
  
  <pre><code>var charset = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j,", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
  
  function bruteForce() {
  
      var password = document.getElementById("enteredPassword").value;
      var crackedPassword = "";
  
      while (true) {
          if (crackedPassword != password) {
              for (int i; i &lt; charset.lenght; i++) {
                  crackedPassword += charset[i];
                  document.getElementById("currentPassword").value = crackedPassword;
              }
          } else {
  
              document.getElementById("currentPassword").value = crackedPassword;
              alert("finished");
          }
      }
  }
  </code></pre>
  
  <p>It gives me the following error: <code>Uncaught SyntaxError: Unexpected identifier</code>
  <br>the line causing the problem:
  <code>for(int i = 0; i &lt; charset.lenght; i++){</code>                                                                                    </p>
  
  <p><br>And: <code>Uncaught ReferenceError: bruteForce is not defined</code>
  <br> line: <code>&lt;input onClick = "bruteForce()"   name="input" type="image" src="arrow.jpg" align="right" /&gt;</code></p>
  
  <p>I thing it has to do with that <code>crackedPassword += charset[i];</code><br>
  But what I saw <a href="https://stackoverflow.com/questions/1288095/append-to-string-variable">here</a>, confused me, because there has to be another cause! </p>