charCodeAt() in JavaScript

<script language="JavaScript">
    <!--
    var myString = new String("This is a test");
    var myIndex = prompt("Please enter a number", "");
    var myCharCode = myString.charCodeAt(myIndex);
    var myChar = myString.charAt(myIndex);


    document.write('<b>The string you searched through was: </b>' + myString);
    document.write('<br>The ' + myIndex + ' character in this string is ');

    if (myChar == " "){
      document.write('<space>');
    }else{
      document.write(myChar);
    }
    document.write(' and its ISO-Latin-1 code is ' + myCharCode);
    -->
    </script>