Answers for "js remove replace all spaces with -"

6

javascript replace all space

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

remove all spaces from string javascript

console.log(' a b    c d e   f g   '.replaceAll(' ',''));
//abcdefg
Posted by: Guest on November-26-2021

Code answers related to "js remove replace all spaces with -"

Code answers related to "Javascript"

Browse Popular Code Answers by Language