setTimeout in JavaScript

Опубликовано: 29 Сентябрь 2024
на канале: Technical Glitch
100
6

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

Syntax: setTimeout(callbackFunction, delay)

Return value : It returns a integer id and it is used with clearTimeout() for preventing function from start.

Important points related to setTimeout
(1). It execute only once.
(2). It is asynchronous function.
(3). It is a part of Web API or window object.