Modern JavaScript from Scratch
100%
Final quiz · Results

You passed

80%
Passed

4 of 5 right. The pass mark is 70%.

Your answers

  1. Question 1 · Right
    Which method returns the first element that matches a CSS selector?
    Your answer:
    querySelector()

    querySelector() takes any CSS selector and returns the first match, or null. querySelectorAll() returns every match.

  2. Question 2 · Not quite
    Which of these events bubble up to parent elements?
    Your answer:
    click, keydown, focus
    Right answer:
    click, keydown

    click and keydown bubble. focus and mouseenter don't; use focusin and mouseover when a parent needs to hear them.

  3. Question 3 · Right
    setTimeout(fn, 0) runs fn before the next line of code.
    Your answer:
    False

    Even with a delay of zero, the callback waits in the queue until the code running now has finished. The next line runs first.

  4. Question 4 · Right
    With event delegation, where do you attach the listener?
    Your answer:
    On a parent of the children

    One listener on a parent hears events from all of its children, including children added later, through bubbling.

  5. Question 5 · Right
    What does new FormData(form) collect?
    Your answer:
    The named fields and their values

    FormData collects each named, enabled field and its current value, the same set the browser would send.