title = title.replace(/\s/g , "-");
let originalText = 'This is my text';
let dashedText = originalText.replace(/ /g, '-');
title = title.replace(/\s/g , "-");
var html = "<div>" + title + "</div>";
// ...
const str = "Sonic Free Games";
str = str.replace(/\s+/g, '-').toLowerCase();
console.log(str); // "sonic-free-games"
const text = "codetogo saved me tons of time";
text.replace(/ /g, "-");