The setInterval() method repeats or re-schedules the given function at every given time-interval. It is somewhat like window.setInterval() Method of JavaScript API, however, a string of code can’t be passed to get it executed.

Syntax:

setInterval(timerFunction, millisecondsTime);

Parameter: It accepts two parameters which are mentioned above and described below:

  • timerFunction <function>: It is the function to be executed.
  • millisecondsTime <Time>: It indicates a period of time between each execution.

The setTimeout() method is used to schedule code execution after waiting for a specified number of milliseconds. It is somewhat like _window.setTimeout() _Method of JavaScript API, however a string of code can’t be passed to get it executed.

Syntax:

setTimeout(timerFunction, millisecondsTime);

Parameter: It accepts two parameters which are mentioned above and described below:

  • timerFunction <function>: It is the function to be executed.
  • millisecondsTime <Time>: It indicates a period of time between each execution.

#javascript #node.js #web technologies #node.js-misc #programming

How to sorting an array without using loops in Node.js?
2.45 GEEK