JavaScript 字符串charCodeAt函数


JavaScript 字符串charCodeAt函数

<html>
   <head>
      <title>JavaScript String charCodeAt() Method</title>
   </head>

   <body>

      <script type = "text/javascript">
         var str = new String( "This is string" );
         document.write("str.charCodeAt(0) is:" + str.charCodeAt(0));
         document.write("<br />str.charCodeAt(1) is:" + str.charCodeAt(1));
         document.write("<br />str.charCodeAt(2) is:" + str.charCodeAt(2));
         document.write("<br />str.charCodeAt(3) is:" + str.charCodeAt(3));
         document.write("<br />str.charCodeAt(4) is:" + str.charCodeAt(4));
         document.write("<br />str.charCodeAt(5) is:" + str.charCodeAt(5));
      </script>

   </body>
</html>