Upgrade to Pro — share decks privately, control downloads, hide ads and more …

跟上_JS_的腳步-ES2020.pdf

 跟上_JS_的腳步-ES2020.pdf

CypressKuo

August 28, 2020
Tweet

More Decks by CypressKuo

Other Decks in Technology

Transcript

  1. Dynamic import This repository contains a proposal for adding a

    "function-like" import() module loading syntactic form to JavaScript. It is currently in stage 4 of the TC39 process. Babel: @babel/plugin-syntax-dynamic-import · Babel
  2. Nullish Coalescing It is currently in stage 4 of the

    TC39 process. Babel: @babel/plugin-proposal-nullish-coalescing-operator · Babel 0 || 123; // 123 0 ?? 123; // 0
  3. Optional Chaining It is currently in stage 4 of the

    TC39 process. Babel: @babel/plugin-proposal-optional-chaining · Babel
  4. Promise.allSettled It is currently in stage 4 of the TC39

    process. 在所有給定的 promise 都已 fulfilled 或被 rejected 後,才執行下一步
  5. 同場加映: Promise 三兄弟 Promise.all 全部 promise 都要 fulfilled,才會返回 fulfilled 其中有一個被

    rejected,就直接返回第一個被 reject 的值 Promise.any 全部 promise 都要 rejected,才會返回 rejected 其中有一個為 fulfilled,就直接返回第一個被 fulfilled 的值 Promise.race 直接返回第一個被 fulfilled / rejected 的 promise 其結果值