Function setTimeout

  • The global setTimeout() method sets a timer which executes a function or specified piece of code once the timer expires.


    • handler: TimerHandler

      The function or string to be executed after the timer expires.

    • timeout: number = 0

      The time, in milliseconds, the timer should wait before the specified function or code is executed. 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 clearTimeout() method to cancel the timer.