SOURCE

// 13,写一个function,清除字符串前后的空格
// 使用自带接口trim(),考虑兼容性:
String.prototype.strTrim = function (){
    return this.replace(/^\s+/,'').replace(/\s+$/,'') 
}
let str = '           123          '
str = str.strTrim()
console.log(str)
console 命令行工具 X clear

                    
>
console