slice() method extracts a section of a string and returns it as a new string.
Note: This method does not alter the original string.
|start||Required||Specifies the starting point to begin the extraction.|
If positive, the starting point is set from first character of this string.
If negative, the starting point is set from (str.length + your value).
i.e., if your value is -5, then the starting point is (str.length + (-5))
|end||optional||Specifies the ending point to end the extraction.|
If omitted the default value is the length of the string.
|str||Returns a new string containing the extracted section of the string.|
str.slice(x, y) with Two Arguments
str.slice(-x) with Negative Argument
Please do google search for:
Join Our Channel
This channel is primarily useful for Full Stack Web Developer.