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