The substring() method extracts the characters from a string, between two specified indices, and returns the new sub string.
This method extracts the characters in a string between "from" and "to", not including "to" itself.
This method has the form:
|from||(required) The index where to start the extraction. First character is at index 0|
|to||(optional) The index where to stop the extraction. If omitted, it extracts the rest of the string|
Note: This method does not change the existing strings, it only returns a copy of the joined strings.
The following example shows the basic use of this method.
This produces the following result: