Skip to content

Instantly share code, notes, and snippets.

@liddiard
Created May 12, 2023 23:02
Show Gist options
  • Save liddiard/dcdf661d03b5516b50da1cf3ac95885e to your computer and use it in GitHub Desktop.
Save liddiard/dcdf661d03b5516b50da1cf3ac95885e to your computer and use it in GitHub Desktop.
One-liner sleep function to use in JavaScript with async/await
const sleep = s => new Promise(r => setTimeout(r, s*1000));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment