menghapus

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