title: Converting text to Unicode in javascript
body: <p>I have the following:</p>
  
  <pre><code>function showUnicode()
  {
    var text = prompt( 'Enter the wanted text', 'Unicode' ),
        unicode = 0,
        ntext,
        temp,
        i = 0
    ;
  
    // got the text now transform it in unicode
    for(i; i &lt; text.length; i++)
    {
      unicode += text.charCodeAt(i)
  
    }
  
    // now do an alert
    alert( 'Here is the unicode:\n' + unicode + '\nof:\n' + text )
  
  }
  </code></pre>
  
  <p>Thanks for the idea to initialize unicode but now unicode  variable gets the Unicode of the last character, why does it?</p>