Created
January 29, 2019 12:41
-
-
Save Chuloo/a4fb7590db766a9e5d1a393abfc1a9b6 to your computer and use it in GitHub Desktop.
Remove all commas in a string
This file contains 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
// new string with commas | |
const stringWithCommas = 'I, want, to, come, home'; | |
// split string by the commas into an array | |
const wordArray = stringWithCommas.split(', ') | |
// join array into a string with a space as separator. | |
const stringWithoutCommas = wordArray.join(' '); | |
// display new string | |
console.log(stringWithoutCommas) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment