title: JavaScript While loop not working
body: <p>I have been trying to develope javascript to recognise a name, display the name, its length and the the letters and what position they appear but i cannot seem to get the while loop to work. could someone please help me out, thanks.</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html &gt;
  &lt;head&gt;
      &lt;title&gt;
          javascript
      &lt;/title&gt;
      &lt;script&gt;
          function displayName(){
  
          var str = prompt("enter your name:");
          var len = str.length;
          var chara = str.charAt(0);
          var n = chara.indexOf(0);
  
  
          while(chara &lt;= len){
                  document.write("&lt;br&gt;the letter " + chara + " is number " + n);
                  chara++;
              }
  
             document.write("the name entered is: " + str + "&lt;br&gt;&lt;/br&gt;" + "the length is " +  len);
  
              }
  
       &lt;/script&gt;
  
  
  &lt;/head&gt;
    &lt;body&gt;
  
       &lt;script&gt;
        displayName();    
       &lt;/script&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;    
  </code></pre>