Skip to content

Instantly share code, notes, and snippets.

@alirshin
alirshin / jsIdle.js
Created July 30, 2024 00:53 — forked from DavidThomas-coder/jsIdle.js
JavaScript Idling Function
function jsIdle(seconds) {
return new Promise(resolve => setTimeout(resolve, seconds * 1000));
}
async function showIdle(seconds) {
await jsIdle(seconds);
console.log(`Waited for ${seconds} seconds!`);
}
showIdle(3);