-2

I developed a clock, and I need a loop that returns "s" at every second

There is only one function in my program

I am lost in creating this loop, can you guys help me?

Progman
  • 16,827
  • 6
  • 33
  • 48

1 Answers1

1

You can use setInterval :

setInterval(() => {
    // your code
}, 1000); // 1000ms = 1second

You can read the documentation here

mvetois
  • 111
  • 11