去除字符串首尾空格方法: str.trim()
去除字符串首尾空格方法:
str.trim()
去除字符串首尾及中间空格方法: let str = ' a b c ' str = str.replace(/s*/g,'') console.log(str)