Learn JavaScript
Advanced String Manipulation

Extracting a Part of String

The slice() method returns a part of the string. We can determine which part gets extracted by providing the start-index and the end-index. The character at the end-index is not included.

However, if we do not provide the end-index, the result will contain the characters in the main string from the start-index to the last character.