menghapus
var string = str.replace(/\ /g, '');
Perfect Peccary
var string = str.replace(/\ /g, '');