Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

JavaScript promises MDN

async function foo() {
  try {
    const result = await doSomething();
    const newResult = await doSomethingElse(result);
    const finalResult = await doThirdThing(newResult);
    console.log(`Got the final result: ${finalResult}`);
  } catch(error) {
    failureCallback(error);
  }
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #JavaScript #promises #MDN
ADD COMMENT
Topic
Name
9+2 =