SOURCE

function trim(str) {
   const reg = new RegExp(" ", "g");
   const a = str.replace(reg, "");
   console.log(a);
}

s = "   123543";
trim(s);
console 命令行工具 X clear

                    
>
console