Method of String object Description start is a character index. The index of the first character is 0, and the index of the last character is str.length-1 . If start is negative, substr uses it as a character index from the end of the string. If length is 0 or negative, substr returns no characters. If length is omitted, start extracts characters to the end of the string.
Parameters string is any string.
If indexA is less than zero, indexA is treated as if it were 0. If indexB is greater than stringName .length, indexB is treated as if it were stringName .length. If indexA equals indexB , substring returns an empty string. If indexB is omitted, indexA extracts characters to the end of the string. In the second write, the index numbers are swapped.