Skip to content

Latest commit

 

History

History
10 lines (8 loc) · 174 Bytes

Readme.md

File metadata and controls

10 lines (8 loc) · 174 Bytes

去除字符串前后空格

function trim(str) {
    return str.replace(/(^\s*)|(\s*$)/g, "")
}

let str = "  jaw il "
console.log(trim(str)) // "jaw il"