JavaScript String substr()
JavaScript String substr()
The substr() method is used to extract a part of a string. This method begins at a specified position and returns a specified number of characters. However, it will not change the original string.
Syntax:-
Its syntax is:- string.substr(start, length)
Return:-
Its return is:- string containing the extracted part
Further Explanation:-
Parameter | Description |
start | Required. The start position. |
length | Optional. The number of characters to extract. |