In this section, yow will learn how to remove spaces from the string.
Here is the code:
var string="All glitters are not gold";
var newString=string.split(' ').join('');
document.write("The original string is = "+string+"<br>");
document.write("After removing the spaces, the string becomes = "+newString);
Output will be displayed as:
Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles