BenL
0
Q:

javascript replace spaces with nbsp

title = title.replace(/\s/g , "-");
2
let originalText = 'This is my text';
let dashedText = originalText.replace(/ /g, '-');
1
title = title.replace(/\s/g , "-");
var html = "<div>" + title + "</div>";
// ...
0
const name = 'Hi my name is Flavio'
name.replace(/\s/g, '') //HimynameisFlavio
0
var replaced = str.replace(/ /g, '_');
0
str = str.replace(/\s/g, "&nbsp;");
0
str = str.replace(/\s/g, "<br>");
0

New to Communities?

Join the community