replace spaces with backslash js

title = title.replace(/\s/g , "-");

3.88
9
Awgiedawgie 440220 points

                                    input = "Hello my name is Luke"
inputWithoutSpaces = input.replace(/\s/g, "_"); // \s == space
console.log(inputWithoutSpaces); //Output: "Hello_my_name_is_Luke"

3.88 (8 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to replace dash with space js replace spaces with dashes js javascript string replace space with dash typescript replace space with dash javascript replace all spaces with dashes replace space to dash js to lowercase and replace spaces with dashes javascript replace spaces with dashes replace space in string with dash javascript how to replace a space with dash in javascript function replace spaces with dashes javascript js string replace spaces with dashes javascript create handle replacing spaces with dashes how to replace dash with space in javascript how to replace space with dash in javascript How to replace spaces with dashes in JavaScript how to replace space with dash in a string javascript replace spaces with dash js replace space with dash js javascript replace dash with space replace dash with space js javascript combine string replace spaces with dashes replace space in javascript replace all whitespace javascript replace space javascript replace spaces with backslash js replace all spaces javascript javascript replace spaces with dash javascript replace space with - javascript replace space with hyphen jquery replace space with dash javascript replace spaces with dashes js string replace space with dash replace spaces in string javascript replace space dash javascript javascript convert space to dash how to replace whitespace with dashs in js replace space with dash javascript replace space with dash remove spaces for dash js react replace space with dash js replace spaces with dashes js replace space with dash javascript replace space with dash js replace all spaces with dash javascript relace space with hyphen
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source