Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript async delay

const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

(async () => {
  console.log('1');
  await delay(1000);
  console.log('2');
})();
Comment

node js async delay

const { promisify } = require('util');

const delay = promisify(setTimeout);

// Usage:
(async () => {
  console.log('1');
  await delay(1000);
  console.log('2');
})();
Comment

PREVIOUS NEXT
Code Example
Javascript :: regular expression for email validation 
Javascript :: random number in javascript between two numbers 
Javascript :: check if an array contains a string in javascript 
Javascript :: jquery ajax get with authentication 
Javascript :: react array.map with return 
Javascript :: date range filter 
Javascript :: react native environment variables 
Javascript :: javascript arithmetic operators 
Javascript :: conditional classname prop react 
Javascript :: redirect in vue 
Javascript :: expressjs async await 
Javascript :: how to get text from input js 
Javascript :: javascript convert timestamp to formatted date 
Javascript :: square node js 
Javascript :: how to calculate the time complexity of a recursive function 
Javascript :: jquery header basic auth 
Javascript :: app use morgan 
Javascript :: react select with custom option 
Javascript :: localstorage vs sessionstorage 
Javascript :: axios how to get error response 
Javascript :: quotation marks javascript 
Javascript :: react js date ago 
Javascript :: boucle for in js 
Javascript :: hmac_sha256 node 
Javascript :: antd datepicker set min max 
Javascript :: check user by id discord js 
Javascript :: bindparam 
Javascript :: javascript todataurl 
Javascript :: add parameter to serialize javascript 
Javascript :: for loop set timeout 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =