Alternative to "window.setInterval()"?

Hi, I am looking for a way to make a function run at a specific time?

I tried with " if ( hourMinutes == “1112” ){" but that’s not working

How about setInterval() ?

Something like this:

    setTimeout(() => {
  	// your code here
    }, 1000);

Worked perfectly ! Thanks you my bad

Apparently, the Timeout is running only when I’m on the page, is there a way to make it run automaticaly even if no one is on the page ?