Courses / JavaScript
62. String.prototype.repeat()
Returns a new string with a specified number of copies of the string.
1 min read Chapter 62 of 99
JavaScript
String.prototype.repeat()
String.prototype.repeat() creates a new string by repeating the original string a specified number of times.
"I often need to display a message multiple times without typing it out over and over."
The `repeat()` method returns a new string that consists of the original string repeated a specified number of times, making it easy to generate repetitive text.
"I often need to display a message multiple times without typing it out over and over."
The `repeat()` method returns a new string that consists of the original string repeated a specified number of times, making it easy to generate repetitive text.