var stringWithCommas = 'a,b,c,d'; var stringWithoutCommas = stringWithCommas.replace(/,/g, ''); console.log(stringWithoutCommas);