Skip to content

字符串扩展 trimStart() 和 trimEnd()

js
let str = '     sdhsjhdjsd     ';
console.log(str); // '     sdhsjhdjsd     '
console.log(str.trimStart()); // 'sdhsjhdjsd     '
console.log(str.trimEnd()); // '     sdhsjhdjsd'

Released under the MIT License.