JavaScript String slice()
JavaScript String slice()
The slice() method is used to extract a part of a string. It will return extracted part in a new string and does not have any effect on the original string. A negative number will start selecting from the end of the string.
Syntax:-
Its syntax is:- string.slice(start, end)
Return:-
Its return is:- extracted part of string
Further Explanation:-
Parameter | Description |
start | Required. The start position. |
end | Optional. The end position. |