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.

Read Also:  Responsive back to top using jquery

Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  javascript remove last comma from string
  2. Read Also:  javascript remove last comma from Array
  3. Read Also:  How to Remove the Last Character of a String in javascript?
  4. Read Also:  Remove Last Comma from String using jQuery
  5. Read Also:  javascript split string by comma
  6. Read Also:  Send PHP variable to bootstrap modal popup via Ajax
  7. Read Also:  how to get current latitude and longitude in php?
  8. Read Also:  PHP Laravel 6 SweetAlert jQuery Ajax Delete Rows Example
  9. Read Also:  PHP Laravel Autocomplete search from Database Example
  10. Read Also:  Convert character to ASCII code in JavaScript Example
CLOSEX