Gets a substring.
| Parameters | Description |
|---|---|
| start | The beginning index, inclusive, where 0 is the first index in the string. |
| end | The ending index, exclusive. Defaults to the rest of the string. |
| Return value | Description |
|---|---|
| string | The substring. |
var cities = new String("Paris Moscow Tokyo");
cities.substring(8)
(2) The following example prints Moscow (index 8 to index 14, exclusive) from the string.
var cities = new String("Paris Moscow Tokyo");
cities.substring(8, 14)