replacing characters in string javascript

48

replacing characters in string javascript -

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

console.log( newStr );  // "this-is-a-test"

Comments

Submit
0 Comments