+ 1
How to convert a string of many words to a string of letters ignoring the spacing between in javascript?
I think it's best to give an example: "I love this app". I want this string to be converted to "Ilovethisapp". Can anyone help please?
2 Respuestas
+ 4
string = string.replace(/ /g, "") ;
Jonas Fallmann, yours will not work since you forgot the "g" keyword.
+ 3
var string = "I love this app";
string = string.replace(" ", "");
EDIT:
cheeze's solution works. I just don't get it, why my solution only removes the first white-space.