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
## Repeat a String Repeat a String
JavaScript
2
435
February 2, 2021
Basic algorithm: Repeat a String. loop problem
JavaScript
14
1494
February 2, 2021
freeCodeCamp Challenge Guide: Repeat a String Repeat a String
Guide
36
170249
January 7, 2025
Repeat a String Repeat a String Problem?
JavaScript
5
636
January 25, 2021
Repeat a string repeat a string
31
5986
January 16, 2021