substring() method extracts part of the string from the start index up to and excluding the end index, or to the end of the string if no end index is supplied.
syntax ↴
substring(start, end) ↴
start The index of the first character to include in the returned substring.
end (optional). The index of the first character to exclude from the returned substring.
substring() method extracts characters from start to end (exclusive).
substring() method does not change the original string.
If start is greater than end, arguments are swapped: (4, 1) = (1, 4).
Start or end values less than 0, are treated as 0.
myString.substring(start)
myString.substring(start, end)