June 2 Codewar

·

1 min read

It's a small one and I needed a win today! All I had to do is fix a bug.

var replaceDots = function(str) {
  return str.replace(/./, '-');
}

I've been doing a few of these and I remembered that in order to change a string you have to use .split and then .join methods.

My fix below:

var replaceDots = function(str) {
  return str.split('.').join('-');
}