142 of 264 menu

setTimeout function

The setTimeout function sets the delay before code execution. Callback should be passed as the first parameter, the second - the time in milliseconds, indicating after what interval the code specified by the first parameter will start executing. The function returns a unique identifier that can be used to stop the timer. To do this, this identifier should be passed to the clearTimeout function.

Syntax

setTimeout(function, time);

Example

Let's output some text to the console with a delay of 1 second:

setTimeout(function() { console.log('text'); }, 1000);

See also

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline