Skip to main content

repeat

_.repeat(n, string) # Ⓢ [Ⓣ][1] Ⓝ

Repeats the given string n times.

Since​

3.0.0

Arguments​

  1. n (number): The number of times to repeat the string.
  2. string (string): The string to repeat.

Returns​

(string): Returns the repeated string.

Example​

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

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

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