JSFiddle - React, Tailwind, and code Playground

by dmitri_pavlutin

JavaScript

const search = ' ';
const replaceWith = '-';

const result = 'duck duck go'.replaceAll(search, replaceWith);

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