Hello coder, In this blog post we learn to remove commas or any character from a string.
Here we use replace() function of javascript. In case to remove we replace “,” commas with blank. If you want to replace with some new character you just need to pass the new value in the second parameter.
The replace() method returns a new string with some or all matches of a pattern replaced by a replacement
Remove commas or symbol
function removeCommas()
{
var string = "Remove, commas, from, string, javascript";
var result = string.replace(/\,/g,"");
alert (result);
}
Result
Remove commas from string javascript
Remove Characters From String in Javascript
function removeSymbol()
{
var string = "Remove e characters from string javascript";
var result = string.replace(/\e/g,"");
alert (result);
}
Result
Rmov charactrs from string javascript
Remove Quotes From String in Javascript
function removeQuotes()
{
var string = "Remove '' characters from string javascript";
var result = string.replace(/\''/g,"");
alert (result);
}
Result
Remove characters from string javascript
I hope It helps you.

Brijpal Sharma is a web developer with a passion for writing tech tutorials. Learn JavaScript and other web development technology.