Back to Modern JavaScript, TypeScript & Async Web
Final Assessment

Modern JavaScript, TypeScript & Async Web Final Assessment

Test your mastery across ES6+ closures & this binding, destructuring & structuredClone, prototypes & ESM, the Event Loop & microtasks, async/await & AbortController, TypeScript unknown/unions/generics, event delegation & XSS safety, Vite/Vitest tooling, and auth storage. Score 70% or higher to earn your certificate.

Answered 0 of 15 questionsPass mark: 70%
Question 1

Question 1 of 15

Why does for (let i = 0; i < 3; i++) setTimeout(() => console.log(i), 0) print 0, 1, 2 instead of 3, 3, 3?

Question 2

Question 2 of 15

What does this refer to inside an arrow function () => this.name?

Question 3

Question 3 of 15

What is the result of 0 || 25 vs 0 ?? 25?

Question 4

Question 4 of 15

Why does const b = { ...a }; b.prefs.theme = 'dark'; mutate a.prefs.theme too?

Question 5

Question 5 of 15

What happens if external code tries to read account.#balance on a class declaring #balance = 0?

Question 6

Question 6 of 15

In what order do console.log('1'), setTimeout(() => console.log('2'), 0), and Promise.resolve().then(() => console.log('3')) print?

Question 7

Question 7 of 15

What does await fetch('/missing') do when the server responds with HTTP 404?

Question 8

Question 8 of 15

How does AbortController prevent stale search results when a user types quickly?

Question 9

Question 9 of 15

Why is unknown safer than any in TypeScript for JSON.parse() outputs?

Question 10

Question 10 of 15

Why should you assign const _check: never = state in the default branch of a switch over a TypeScript Discriminated Union?

Question 11

Question 11 of 15

Which TypeScript utility type creates a new type from Course containing only id and title?

Question 12

Question 12 of 15

In DOM event delegation, why is e.target.closest('button[data-action]') preferred over e.target.matches(...)?

Question 13

Question 13 of 15

Why should user-entered text be inserted via el.textContent = input instead of el.innerHTML = input?

Question 14

Question 14 of 15

Why should build scripts run tsc --noEmit && vite build instead of vite build alone?

Question 15

Question 15 of 15

Why are HttpOnly cookies preferred over localStorage for sensitive session tokens?

Answer 15 more questions to submit.