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.

Leave a Comment