Posted inJavaScript / jQuery

How to remove the first character of a string in JavaScript?

Today, We want to share with you javascript remove first character from string.In this post we will show you javascript string slice, hear for javascript substring we will give you demo and example for implement.In this post, we will learn about Remove Last Character From String JavaScript with an example.

How to remove first character from a string in jQuery/JavaScript?

Example 1: Using substring()

let str = 'Welcome';
 
str = str.substring(1);
console.log(str);
 
/*
    Output: elcome
*/

asily extended to remove first n characters from the string.

let str = 'Welcome';
let n = 3;
 
str = str.substring(n);
console.log(str);

2. Using slice()

Example 2:

let str = 'Welcome';
 
str = str.slice(1);
console.log(str);
 
/*
    Output: elcome
*/

let str = 'Welcome';
let n = 3;
 
str = str.slice(n);
console.log(str);

Example 3: Using substr()

let str = 'Welcome';
 
str = str.substr(1);
console.log(str);
 
/*
    Output: elcome
*/

I hope you get an idea about Trim First/Last Characters in String.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype