Answers for "remove space from js string using replace"

5

js replace space

// replaces space with '_'
str = str.replace(/ /g, "_");
// or
str = str.split(' ').join('_');
Posted by: Guest on May-11-2021
10

remove space from string javascript

var str = "       Hello World!        ";
alert(str.trim());
Posted by: Guest on March-19-2020

Code answers related to "remove space from js string using replace"

Code answers related to "Javascript"

Browse Popular Code Answers by Language