You can use the while or for loop to create an infinite loop.

While loop

To create an infinite loop with the while loop, we can use the true keyword as the condition.

while (true) {
  // do something
}

For loop

To create an infinite loop with the for loop, we can use the true keyword as the condition.

for (let i = 0; true; i++) {
  // do something
}