Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript promise sleep

function sleep(time) {
                    return new Promise((resolve)=>setTimeout(resolve,time));
                }        
async function main() {
                    await sleep(4000);
                    console.log('4');
                }
                main();
Source by stickynotepickles.herokuapp.com #
 
PREVIOUS NEXT
Tagged: #javascript #promise #sleep
ADD COMMENT
Topic
Name
9+1 =