JavaScript String slice() method

The JavaScript string slice() method retrieves a part of the given string on the basis of the specified index. It is similar to substring, the only difference is that it supports the negative index. In the case of the negative index, it starts retrieving the sub-string from the end of the string. Syntax: string.slice(start_index, end_index) … Read more