ECMAScript新增String方法
ES2017 新增
padStart(), padEnd()
字符串补全功能,接受两个参数,如果第二个参数为空,则默认使用空格补全。
1 | // fill with the template |
ES2019 新增
trimStart(), trimEnd()
与String.trim()
的行为一致,不会修改原字符串。
1 | let str = " string " |
字符串补全功能,接受两个参数,如果第二个参数为空,则默认使用空格补全。
1 | // fill with the template |
与String.trim()
的行为一致,不会修改原字符串。
1 | let str = " string " |