Run

Tutorial With Example

Run your live code

 
 
1
<html>
2
<head></head>
3
<body>
4
  <script>
5
var str = "Hello World!";
6
document.write(str.charAt());  // Prints: H
7
document.write(str.charAt(6)); // Prints: W
8
document.write(str.charAt(30)); // Prints nothing
9
document.write(str.charAt(str.length - 1)); // Prints: !
10
  </script>
11
</body>
12
</html>