去掉字符串的所有空格

es6语法:let str = ' a b c '; let arr = Array.from(new Set(str.split(''))).filter(val => val && val.trim()); str = arr.join('');

原文地址:https://www.cnblogs.com/BBQshq/p/13223071.html