Categories
JavaScript Answers

How to remove leading comma from a string with JavaScript?

Spread the love

To remove leading comma from a string with JavaScript, we call the substring method.

For instance, we write

const myOriginalString = ",'first string','more','even more'";
const myString = myOriginalString.substring(1);

to call myOriginalString.substring with 1 to return a substring of myOriginalString without the first character.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

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