Computer >> Computer tutorials >  >> Programming >> Javascript

How to use the String repeat() method in JavaScript

The JavaScript string repeat() method is used to repeat string values as many times as you specify inside the parenthesis:

let hipHop = "hiphop ".repeat(5)

console.log(hipHop)
// "hiphop hiphop hiphop hiphop hiphop "