charAt() in JavaScript

<script language="JavaScript">
    <!--
    var myString = new String("This is a test, small test.");

    var myIndex = prompt("Please enter a number", "");

    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.close();
    -->
    </script>