Function setInterval

  • The global setInterval() method repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.


    • handler: TimerHandler

      The function or string to be executed every time the interval elapses.

    • timeout: number = 0

      The time, in milliseconds, the timer should delay in between executions of the specified function or code. If this parameter is omitted, a value of 0 is used.

    • Rest...args: any[]

      Additional arguments to be passed to the function specified by the handler parameter.

    Returns number

    The numeric ID of the timer, which can be used later with the clearInterval() method to cancel the timer.