DEV Community

Discussion on: Repeat a String for Num times

Collapse
 
siddharthshyniben profile image
Siddharth • Edited

This function works great, but in the real world, you're better off using the builtin String.prototype.repeat function.

"na ".repeat(10) // => "na na na na na na na na na na " // batman!
Enter fullscreen mode Exit fullscreen mode