Run

Tutorial With Example

Run your live code

 
 
1
<html>
2
<head></head>
3
<body>
4
  <script>
5
var str = "The quick brown fox jumps over the lazy dog.";
6
document.write(str.substr(4, 15)); // Prints: quick brown fox
7
document.write(str.substr(-28, -19)); // Prints nothing
8
document.write(str.substr(-28, 9)); // Prints: fox jumps
9
document.write(str.substr(31)); // Prints: the lazy dog.
10
  </script>
11
</body>
12
</html>