mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2024-04-21 12:32:22 +00:00
doc: add ES7 stage 3 features
This commit is contained in:
@@ -318,6 +318,13 @@ ES7推出了字符串补全长度的功能。如果某个字符串不够指定
|
||||
'xxx'.padEnd(2, 'ab') // 'xxx'
|
||||
```
|
||||
|
||||
如果用来补全的字符串与原字符串,两者的长度之和超过了制定的最小长度,则会截去超出位数的补全字符串。
|
||||
|
||||
```javascript
|
||||
'abc'.padStart(10, '0123456789')
|
||||
// '0123456abc'
|
||||
```
|
||||
|
||||
如果省略第二个参数,则会用空格补全长度。
|
||||
|
||||
```javascript
|
||||
|
||||
Reference in New Issue
Block a user