Advertisement
728x90
The repeat() method is used to construct and return a new string which contains the specified number of copies of the string on which it was called, concatenated together. Remember that this method has been added to the ECMAScript 2015 specification.
Let's take an example of Hello string to repeat it 4 times,
javascript
1"Hello".repeat(4); // 'HelloHelloHelloHello'Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 4
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
347of476