https://www.freecodecamp.org/news/javascript-timers-everything-you-need-to-know-5f31eaa37162/
Here are a couple different ways to do timers in JavaScript
Every X seconds do
We can use the setInterval global function to run code (myFunc()) every second.
setInterval(() => {
myfunc()
}, 1000)
Execute X after Y seconds
Replace console.log with the code you want to execute with a delay.
setTimeout(() => {
console.log("Hello World")
}, 1000)