Appearance
用于移除字符串两端的空白字符
const trim=str=>str.replace(/^\s+|\s+$/g, "");
let str=' 123' let str2=' 123 ' console.log(trim(str)); // 123 console.log(trim(str2)); // 123