js 去除字符串中的空格

去除字符串首尾空格方法:

str.trim()

去除字符串首尾及中间空格方法:
let str = '   a  b  c '
str = str.replace(/s*/g,'')
console.log(str)
原文地址:https://www.cnblogs.com/knuzy/p/11059098.html