English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
repeat()The method returns a new string that contains the specified number of copies of the called string concatenated together.
string.repeat(count)
var str = 'oldtoolbag.com'; str.repeat(4);Test to see‹/›
The numbers in the table specify the first browser version that fully supports the repeat() method:
Method | |||||
repeat() | 41 | 24 | Yes | 9 | 12 |
Parameter | Description |
---|---|
count | The number of times the original string value should be repeated in the new string |
Return Value: | A new string containing the specified number of copies of the given string |
---|---|
Exception Cases: | RangeError: The repetition count must be a non-negative number, and the repetition count must be less than infinity and cannot overflow the maximum string size |
JavaScript Version: | ECMAScript 6 |