Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js replace space with underscore

var string = "my name";
string = string.replace(/ /g,"_"); //returns my_name
Comment

javascript replace space by underscore

// replaces space with '_'
str = str.replace(/ /g, "_");
// or
str = str.split(' ').join('_');
Comment

PREVIOUS NEXT
Code Example
Javascript :: urlencode javascript 
Javascript :: js replace single quote with doubel quote 
Javascript :: jquery remove string from string 
Javascript :: invalid host header vue 
Javascript :: vscode debug ignore node_modules 
Javascript :: set value in span using javascript 
Javascript :: This error occurred during the build time and cannot be dismissed. 
Javascript :: js async anonymous function 
Javascript :: javascript float element right 
Javascript :: make react app 
Javascript :: jquery check if div has a certain style 
Javascript :: serialize and send form data jquery ajax 
Javascript :: yup email validation 
Javascript :: npm ERR! Fix the upstream dependency conflict, 
Javascript :: scroll to element javascript 
Javascript :: get html attribute value in js 
Javascript :: how to reload the same page using javascript 
Javascript :: just number regex js 
Javascript :: adding a button in javascript 
Javascript :: javascript ucwords 
Javascript :: javascript function to generate random alphanumeric string 
Javascript :: hot to make a funtion constantly active JS 
Javascript :: js for each element class 
Javascript :: sort array of object js 
Javascript :: how to check if a string contains only spaces in javascript 
Javascript :: discord.js cooldown 
Javascript :: how to remove the last character of a string in javascript 
Javascript :: get value of selected checkbox jquery 
Javascript :: angular limit string length 
Javascript :: tolowercase javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =