js 去掉全部空格

js 去掉所有空格

 function trim(s) {
  var   reg   =   /\s/g;  
  var   str =   s.replace(reg,   "");  
return str;
 }