let str = " a b c ";
1:取掉字符串中的首尾空格:
console.log("trim",str.trim());2:取掉字符串中的所有空格:
str.replace(/s/ig,'')