June 2 Codewar

AnahiAnahi
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('-');
}
0
Subscribe to my newsletter

Read articles from Anahi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Anahi
Anahi

Mom of two munchkins and a crochet enthusiast. Mexican-American. Navigating through the tech world. Learning new things every day. Taking it one day at a time.