title: How do I avoid getting "unexpected token Var" in JavaScript when using loops
body: <p>I'm trying to count the number of e's in a string and then display it using a while loop I keep getting <code>"Uncaught SyntaxError: Unexpected token var"</code> when running my code, any idea how to fix this issue?</p>
  
  <pre><code>var sentence = "I'm learning JavaScript in my web development module.";
  var charLength = sentence.length;
  var count = 0;
  
  while(var z=0;z!=charLength;z++;){
      if(sentence.CharAt(z)== "e" {
          count++;
      } 
  }
  console.log(count);
  </code></pre>