Skip to main content

Command Palette

Search for a command to run...

June 2 Codewar

Published
1 min read
A

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.

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('-');
}