using async/await to catch errors

javascript,es6,object,web_development

async function executeAsyncTask () {
  try {
    const valueA = await functionA();
    const valueB = await functionB(valueA);
    const valueC = await functionC(valueB);
    return await functionD(valueC);
  }
  catch (err) {
    logger.error(err);
  } finally {
    await alwaysExecuteThisFunction();
  }
}

Có thể bạn đã miss một số snippets code

Spread Operator for Objects

Using the spread operator during an Object declaration will assign the properties of the referenced Object to the new Object.

Extend Object javascript

Extend Object javascript

javascript rand

The Math.random() function returns a floating-point, pseudo-random number in the range 0 to less than 1

Promise + gì

promise + gì

Convert Array-like to True Array

Convert Array-like to True Array