“Javascript Sleep 1 s” Respostas de código

Javascript Sleep por 1 segundo

function delay(time) {
  return new Promise(resolve => setTimeout(resolve, time));
}

delay(1000).then(() => console.log('ran after 1 second1 passed'));
Powerful Puma

Javascript Sleep 1 Second

function delay(time) => new Promise(resolve => setTimeout(resolve, time));

delay(1000).then(() => console.log('ran after 1 second1 passed'));
Long Lyrebird

espere javascript

 wait(ms) {
        return new Promise(resolve => setTimeout(resolve, ms));
 }
Graceful Guanaco

Javascript Sleep 1 Second

# this is just a trial of adding answers with Grepper
Mohieddine Farid

Javascript Sleep 1 Second

setTimeout(myFunction, 3000);

// if you have defined a function named myFunction 
// it will run after 3 seconds (3000 milliseconds)
function test1()
{    
    // let's say JavaScript did have a sleep function..
    // sleep for 3 seconds
    sleep(3000);

    alert('hi'); 
}
Kalyani Sree Selvaganesan

Javascript Sleep 1 s

add grepper answer
Bright Bug

Respostas semelhantes a “Javascript Sleep 1 s”

Perguntas semelhantes a “Javascript Sleep 1 s”

Mais respostas relacionadas para “Javascript Sleep 1 s” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código