js正则去空格

var str = " 1 sa s ";
str = str.replace(/\s/g, '');

 

posted @ 2019-05-23 15:33  tristam  阅读(641)  评论(0编辑  收藏  举报