“Avascript Sleep 1 seconde” Réponses codées

JavaScript dors pendant 1 seconde

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 seconde

async function test() {
  console.log('start timer');
  await new Promise(resolve => setTimeout(resolve, 1000));
  console.log('after 1 second');
}

test();
Clear Cat

JavaScript Sleep 1 seconde

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

async function test() {
  console.log('start timer');
  await delay(1000);
  console.log('after 1 second');
}

test();
MorbidMeta

JavaScript Sleep 1 seconde

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

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

JS dors 1 seconde

await new Promise(resolve => setTimeout(resolve, milliseconds))
xXjojaXx

Avascript Sleep 1 seconde

setTimeout(myFunction, 1000);
Kawsar Khan

Réponses similaires à “Avascript Sleep 1 seconde”

Questions similaires à “Avascript Sleep 1 seconde”

Plus de réponses similaires à “Avascript Sleep 1 seconde” dans JavaScript

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code