JavaScript 字符串charAt函数


JavaScript 字符串charAt函数

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

   <body>

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

   </body>
</html>