Created
January 2, 2017 22:54
-
-
Save chrislaughlin/0228d93fd0d4efea42a8f6de8f4eb837 to your computer and use it in GitHub Desktop.
String Replace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myString = "This string has many spaces"; | |
console.log(myString.replace(/ /,"")); | |
//"Thisstring has many spaces" | |
console.log(myString.replace(/ /g,"")); | |
//"Thisstringhasmanyspaces" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment