how to replace commas with nothing in javascript

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

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

Also in JavaScript: