Script Valley
JavaScript: The Complete Language
DOM Manipulation and Browser APIs/Assessment

Practice & Assessment

Test your understanding of DOM Manipulation and Browser APIs

Multiple Choice Questions

6
1

What is the difference between event.target and event.currentTarget?

2

Why should you not store authentication tokens in localStorage?

3

When is requestAnimationFrame better than setInterval for animations?

4

What does event delegation mean?

5

What does calling querySelector return when no element matches the selector?

6

What is layout thrashing?

Coding Challenges

1
1

Infinite Scroll Feed

Build an HTML page with a scrollable feed. Use IntersectionObserver to detect when a sentinel div at the bottom enters the viewport. When it does, append 10 more hardcoded card elements to the feed and move the sentinel to the bottom. Use event delegation on the feed container to log the card's data-id when clicked. No libraries. Input: user scroll action. Output: new cards appended. Time estimate: 30 minutes.

Medium

Mini Project

1

Real-Time Search Filter UI

Build a single HTML file with a product search interface. Include a list of 20 hardcoded products each with name, category, and price. Implement: (1) a text input that filters products by name on each keypress using input event and event delegation, (2) category filter buttons that filter by category (use data-category), (3) sort buttons for price ascending/descending that re-render sorted results, (4) persist the active filter and sort state in localStorage so they survive page refresh, (5) animate newly rendered cards using requestAnimationFrame for a stagger-in reveal effect. Use querySelector, createElement, classList, dataset, textContent, and addEventListener. No frameworks or libraries.

Medium
Practice & Assessment โ€” DOM Manipulation and Browser APIs โ€” JavaScript: The Complete Language โ€” Script Valley โ€” Script Valley