I am gonna show you three methods to print a word 100 times in Javascript.
Let’s greet a person 100 times.
Using for loop:
for(var i = 1; i < 101; i ++)
{
console.log("Hello")
}
Using while loop:
var i = 1
while(i < 101)
{
console.log("Hello");
i = i + 1;
}
Using repeat() function:
var x = "hello\n".repeat(4)
console.log(x)