What is the JavaScript version of sleep()?
2017 — 2021 update Since 2009 when this question was asked, JavaScript has evolved significantly. All other answers are now obsolete or overly complicated. Here is the current best practice: Run code snippet This is it. await sleep(<duration>). Or as a one-liner: Note that, await can only be executed in functions prefixed with the async keyword, or at the … Read more