JS

HOW TO RUN JAVASCRIPT EVERY SECOND

FUNCTION TO RUN EVERY SEC var looper = () => {   console.log(”RUN!”);  };   SET 1-SEC INTERVAL setInterval(showTime, 1000);

SET INTERVAL

01

FUNCTION TO RUN EVERY SEC var looper = () => {   console.log(”RUN!”);     CALL ITSELF AFTER 1 SEC   setTimeout(looper, 1000);  };   START! looper();

RECURSIVE FUNCTION

02

ENDLESS WHILE LOOP

03

FUNCTION TO RUN EVERY SEC var looper = async () => { while (true) {   console.log(”RUN!”);     WAIT 1 SEC    await new Promise(res =>    setTimeout(res, 1000));  }};   START! looper();