remove spaces before and after javascript code example
Example 1: js remove space from string
string.split(" ").join("")
Example 2: js remove space before string
var str = " Some text ";
str.trim();
// str = "Some text"
string.split(" ").join("")
var str = " Some text ";
str.trim();
// str = "Some text"