Remove first character of a string in javascript

In this programming tutorial we will learn how to remove first character of a string in javascript. I have already written a tutorial that demonstrates how to remove last character of a string in javascript. Removing first character of a string can be easily done by using some built-in javascript functions. I will discuss two methods to achieve the task. Let's have a look over the examples given below.
Remove first character of a string in javascript
Method 1
var myString="Hello World!";
// newString will contain 'ello World!'
var newString=myString.substring(1);
Method 2
var myString="Hello World!";
// newString will contain 'ello World!'
var newString=myString.slice(1,myString.length);
So that's it. I hope you will find this tutorial very handy.
I love your feedback.

0 comments: