Using replace(/\s+/g,""); removes all spaces.
Using replace(" ",""); removes only the first space.
Why?
-
3The g == global (also \s includes more than just " ")Alex K.– Alex K.2014-04-08 13:02:32 +00:00Commented Apr 8, 2014 at 13:02
-
1/g it is global search.Pramod– Pramod2014-04-08 13:02:51 +00:00Commented Apr 8, 2014 at 13:02
-
Thanks all for explanations!nicael– nicael2014-04-08 13:18:55 +00:00Commented Apr 8, 2014 at 13:18
Add a comment
|