The slice() method extracts the section of a string and returns the extracted part in a brand new string. If you want to delete the first character of a string then you should specify the start index from which the string needs to be extracted:
The slice() method can be used to delete first N characters from the string:
The substing() method can also be used to remove first N characters from the string:
The substr() method extracts the part of a string, starting at the character at the specified position, and returns the specified N of characters:
The substr() and substring() methods differ. The substr() method can accept a negative starting position as an offset from the end of the string, while the substring does not. However, the substr() method may be deprecated in future.