javascript remove all spaces from string
snippet in javascript

javascript remove all spaces from string

user6026

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

remove space from string javascript

user9482

var str = "       Hello World!        ";
alert(str.trim());