Naar hoofdinhoud
← ⚑ JavaScript & the browserΒ·Module C3 Β· Les 11
OpdrachtQuick recap. Inside a <script type='module'>: declare async function getOne() returning Promise.resolve(1) and async function getTwo() returning Promise.resolve(2). Then const [a, b] = await Promise.all([getOne(), getTwo()]). console.log a, b, and a+b.

Recap: Modules & async (C1-C3)

50 XP5 min
Theorie

Quick recap β€” Modules C1-C3

Modern syntax + the module system. The 4 pieces you write every day:

  1. `async function` + `await` β€” the only sane way to write fetch / DB / file IO.
  2. `Promise.all([a, b])` β€” fire two independent promises in parallel; await both.
  3. `<script type="module">` β€” opt in to ES modules in the browser. Top-level await works here.
  4. `fetch(url).then(r => r.json())` β€” the universal HTTP shape. await makes it linear.

If any feels random, redo C1-06 / C2-08 / C3-02 / C3-09 then come back.

πŸ”’

Registreer om te beginnen met coderen

Theorie is voor iedereen. De editor, live preview en check ontgrendelen met een 7-daagse gratis proefperiode β€” kaart vereist, opzegbaar.

Registreren β€” gratis proef β†’

De eerste 10 lessen in elke track zijn gratis. Geen kaart nodig.

← VorigeVolgende les β†’

EΓ©n Python- of web-tip per dag β€” per e-mail

Kort, met de hand geschreven, geen spam. Met één klik afmelden.