Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript await return value

//Checkout the entire page, its good content

function first() {
  return new Promise((resolve) => {
    console.log("1st");
    resolve(true); //added by me to catch true or false response
  });
}

function second() {
  return new Promise((resolve) => {
    console.log("2nd");
    resolve(false); //added by me to catch true or false response
  });
}

function third() {
  console.log("3rd");
}

async function fnAsync() {
  await first();
  await second();
  third();
}

fnAsync();
Source by sebhastian.com #
 
PREVIOUS NEXT
Tagged: #javascript #await #return
ADD COMMENT
Topic
Name
3+2 =