JavaScript String repeat() method
returns a new string containing the specified number of copies of given string

repeat() method returns a new string containing the specified number of copies of the given string.

syntax

repeat(count)

count An integer between 0 and +Infinity, indicating the number of times to repeat the string.

repeat() method returns a new string.

repeat() method expects count to be an integer. If a non-integer value is provided, it is rounded down to the nearest integer.

repeat() method returns an empty string "" if count is zero or if no parameter is provided.

repeat() method throws RangeError if count is negative.

repeat() method does not change the original string.

syntax description
return new string containing the specified number (count) of copies
myString.repeat(count)