Date

“String” Methods

_.repeat([string=''], [n=1])

source npm package

Repeats the given string n times.

引入版本

3.0.0

参数
[string=''] (string) : The string to repeat.
[n=1] (number) : The number of times to repeat the string.

返回值
(string) : Returns the repeated string.

示例
_.repeat('*', 3);
// => '***'
 
_.repeat('abc', 2);
// => 'abcabc'
 
_.repeat('abc', 0);
// => ''