Study notes · 8% of the exam

Browser APIs

The browser APIs you use every day: fetch, storage, cancellation and visibility.

Key points

  1. 1

    fetch rejects only on network errors. Check response.ok for HTTP errors.

  2. 2

    Cancel requests with an AbortController signal; build deadlines with AbortSignal.timeout(ms).

  3. 3

    localStorage persists and sessionStorage lasts one tab session; both store strings only.

  4. 4

    IntersectionObserver tells you when elements become visible, which suits lazy loading and infinite scroll.

Common traps

  • Storage can throw (private mode, quota), so wrap access in try/catch.

Test yourself on Browser APIs

Ten questions, with the answer and explanation after each one.