repeat

String
since 3.0.0

Arguments

  • string The string to repeat.
  • number The number of times to repeat the string.

Returns

string the repeated string.

Repeats the given string n times.

Example of Lodash _.repeat

_.repeat('*', 3);
// => '***'

_.repeat('abc', 2);
// => 'abcabc'

_.repeat('abc', 0);
// => ''