Answers for "replace all character of a string javascript"

6

how to replace all characters in a string javascript

const string = "a, b, c, d, e, f";
string.replace(/,/g, '');
console.log(string) //a b c d e f
Posted by: Guest on March-24-2021
1

replace character inside a string in JavaScript

function strReplace(){
        var myStr = 'quick_brown_fox';
        var newStr = myStr.replace(/_/g, "-");
        
        // Insert modified string in paragraph
        document.getElementById("myText").innerHTML = newStr;
    }
Posted by: Guest on March-10-2022
0

replace all character in string javascript

let a = "How to search and replace a char in a string";
while (a.search(" ", ""))
{
   a = a.replace(" ", "");
}
console.log(a);
Posted by: Guest on March-27-2020

Code answers related to "replace all character of a string javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language