Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript best way to create synchronous pause in program

console.log("Start");  
console.time("Promise");  
await new Promise(done => setTimeout(() => done(), 5000));  
console.log("End");  
console.timeEnd("Promise");  
Comment

javascript synchronous wait

function delay(n) {  
  n = n || 2000;
  return new Promise(done => {
    setTimeout(() => {
      done();
    }, n);
  });
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: datatable hide columns 
Javascript :: compare and filter two array of object 
Javascript :: how to pretty formatjson value on terminal ruby 
Javascript :: FullScreen Image By OnClick Jquery 
Javascript :: js get meta-tag name 
Javascript :: Uncaught (in promise): NullInjectorError 
Javascript :: count div class in div jquery 
Javascript :: console.time in javascript 
Javascript :: roblox headshot image 
Javascript :: nuxt js emit event 
Javascript :: move file from one folder to another in aws s3 nodejs 
Javascript :: bash commands in node 
Javascript :: get id of first td jquery 
Javascript :: ant design not working in react js 
Javascript :: factorial of number js 
Javascript :: jquery toggle show hide 
Javascript :: get size of json object 
Javascript :: nodejs check if express started 
Javascript :: javascript remove character from string 
Javascript :: javascript check if time is less than 
Javascript :: how to check if a folder exist if not then create nodejs 
Javascript :: does onclick work for textboxes javascript 
Javascript :: add access-control-allow-origin in node js 
Javascript :: js get vh value 
Javascript :: open gz file node 
Javascript :: sequelize include only 
Javascript :: usereducer hook react 
Javascript :: mysql connection in node js 
Javascript :: sequelize sync 
Javascript :: gcloud storage cors 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =