mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
docs(string): add trimStart()/trimEnd()
This commit is contained in:
parent
c572b57c27
commit
dca90708ac
@ -331,7 +331,7 @@ ES2017 引入了字符串补全长度的功能。如果某个字符串不够指
|
||||
|
||||
## trimStart(),trimEnd()
|
||||
|
||||
ES2019 对字符串实例新增了`trimStart()`和`trimEnd()`这两个方法。它们的行为与`trim()`一致,`trimStart()`消除字符串头部的空格,`trimEnd()`消除尾部的空格。它们返回的都是新字符串,不会修改原始字符串。
|
||||
[ES2019](https://github.com/tc39/proposal-string-left-right-trim) 对字符串实例新增了`trimStart()`和`trimEnd()`这两个方法。它们的行为与`trim()`一致,`trimStart()`消除字符串头部的空格,`trimEnd()`消除尾部的空格。它们返回的都是新字符串,不会修改原始字符串。
|
||||
|
||||
```javascript
|
||||
const s = ' abc ';
|
||||
|
Loading…
x
Reference in New Issue
Block a user