Answers for "how to replace a text that has a character and still keep the character in javascript"

12

replacing characters in string javascript

var myStr = 'this,is,a,test';
var newStr = myStr.replace(/,/g, '-');

console.log( newStr );  // "this-is-a-test"
Posted by: Guest on October-20-2020
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 "how to replace a text that has a character and still keep the character in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language