In the previous article, you have learned to remote last character of a string in JavaScript. If you are looking for remove last character from string, visit here. This tutorial describe you to how to remove first character of a string in JavaScript. You can choose any one of the following methods.
Method 1 – Using substring() function
Use the substring() function to remove the last character from a string in JavaScript. This function returns the part of the string between the start and end indexes, or to the end of the string. Example
Output:
Method 2 – Using slice() function
Use the slice function to remove the last character from any string in JavaScript. This function extracts a part of any string and return as new string. When you can store in a variable. Example:
Output:
Conclusion
In this tutorial, you have learned how to remove first character from a string using JavaScript. You can also read our next tutorial to trim white spaces from string.