padStart
最后更新于:2022-04-02 00:07:17
## padStart
+ [link](./padStart "Link to this entry.")
+ [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L12354 "View in source.")
+ [npm](https://www.npmjs.com/package/lodash.padstart "See the npm package.")
```
_.padStart([string=''], [length=0], [chars=' '])
```
如果字符串长度小于 length 则在左侧填充字符。 如果超出长度则截断超出的部分。
### 参数
1. [string=''] (string)
要填充的字符串
2. [length=0] (number)
填充的长度
3. [chars=' '] (string)
填充字符
### 返回值 (string)
Returns 返回填充后的字符串
### 示例
```
_.padStart('abc', 6);
// => ' abc'
_.padStart('abc', 6, '_-');
// => '_-_abc'
_.padStart('abc', 3);
// => 'abc'
```
';