javascript replace all spaces
var string = "my name";
string = string.replace(/ /g,"_"); //returns my_nameconst name = 'Hi my name is Flavio'
name.replace(/\s/g, '') //HimynameisFlavio
var replaced = str.replace(/ /g, '_');var str = 'a b c';
var replaced = str.split(' ').join('_');
Also in JavaScript:
- passing a variable to the width style div angular
- how to get file extension in javascript last index
- javascript change page title
- javascript update text in div
- javascript get the last element of an array
- node.js
- javascript template string
- shopware 5 subscribe to theme collect javascript
- react bootstrap hide toggle menu when scrolling down
- redux import connect
- installing angular 10
- anonymous function javascript
- jquery remove option from select by value
- regular expression arabic and persion
- js detect mobile
- text background fabricjs
- jquery get selected option value
- javascript Prevent Object MutationPassed
- check how many of a word is in a string
- convert data into json format in javascript
- check if string only contains integer digits numbers javascript
- material css
- smooth scrolll to id js
- string comparison in javascript