Syntax | |
| |
The substring() method returns the characters starting with the indexed position num1 and ending with the character before num2. | |
The string's first character is in position 0. | |
If you pass num1 as a negative number, it will be treated as 0. | |
If you pass num2 as a value greater than the string.length property, it will be treated as string.length. | |
If num1 equals num2, an empty string is returned. | |
It is also possible to pass a single index location to the method. | |
|