String.prototype.repeat()
The repeat() method constructs and returns a new string
which contains the specified number of copies of the string on which it was called,
concatenated together.
Syntax
repeat(count)
Parameters
count- : An integer between
0and+Infinity, indicating the number of times to repeat the string.
- : An integer between
Return value
A new string containing the specified number of copies of the given string.
Exceptions
- Throws a
RangeErrorif repeat count is negative. - Throws a
RangeErrorif repeat count is infinity or overflows maximum string size.