JSFiddle - React, Tailwind, and code Playground

by dmitri_pavlutin

JavaScript

const searchRegExp = /\s/g;
const replaceWith = '-';

const result = 'duck duck go'.replace(searchRegExp, replaceWith);

console.log(result); // => 'duck-duck-go'