The repeat() Function is Used to repeat the String a given number of times.
Let us see the below example.
<html> <body> <script> var x = "Hello" var y = x.repeat(3) document.write(y) </script> </body> </html>
So, if you see the output. The repeat() function,
var y = x.repeat(3)
Repeats the String Hello three times.