Approach #3: Repeat a String using ES6 repeat() method
For this solution, you’ll use the String.prototype.repeat() method:
- 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.
If you want to change selection, open document below and click on "Move attachment"
Three ways to repeat a string in JavaScript – freeCodeCamp2Fu%2F13507232%3Fv%3D3%26s%3D400&key=4fce0568f2ce49e8b54624ef71a8a5bd" data-media-id="0b02a88f1a5e90045e5d05148e621837" src="/media/0b02a88f1a5e90045e5d05148e621837?postId=2a9053b93a2d" height="250" width="700"><iframe><div> Approach #3: Repeat a String using ES6 repeat() method For this solution, you’ll use the String.prototype.repeat() method: 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. Here’s the solution: <%2Fu%2
Summary
status | not read | | reprioritisations | |
---|
last reprioritisation on | | | suggested re-reading day | |
---|
started reading on | | | finished reading on | |
---|
Details