SOURCE

var s = ' 332dd '
function trim(s){
    return s.replace(/^s+|s+$/g,'')
}
console.log(trim(s))
console 命令行工具 X clear

                    
>
console