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:
Liked it! Share this Tutorial