Removing All Spaces From a String Using Javascript

Here is a simple regular expression trick to remove all the spaces from a string using javascript:

str = str.replace(/\s+/g,'');

// where str is your original string

Keep checking for more tips and tricks

Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*