The freeCodeCamp Forum
Repeat the Same Item Multiple Times
JavaScript
pradesh-kumar
June 10, 2018, 5:16pm
3
Try this
function repeat(item,times){ return new Array(times).fill(item); }
3 Likes
show post in topic
Related topics
Topic
Replies
Views
Activity
Basic Algorithm Scripting:Repeat a String Repeat a String
JavaScript
3
844
January 25, 2021
Repeat a String Repeat a String Problem?
JavaScript
5
591
January 25, 2021
## Repeat a String Repeat a String
JavaScript
2
413
February 2, 2021
Basic Algorithm Scripting - Repeat a String Repeat a String
JavaScript
4
257
April 8, 2023
Basic Algorithm Scripting: Repeat a String Repeat a String
JavaScript
7
521
June 1, 2021