-- online Search!

Critical thinking for an AI world

JavaScript Quizzes

Work with values, objects, the DOM, events, and the browser APIs behind interactive pages.

Choose from 107 quizzes below. Practice the concepts you need to judge a solution, recognize faulty assumptions, and find errors in logic or code. Every answer includes an explanation and a link back to the relevant tutorial.

Basics

Introduction to JavaScript

Review page responsibilities, interaction timing, and the environment a proposed solution needs.

5 questions

Take quiz

Your first interactive web page

Review page structure, accessible interaction, event targets, and setup dependencies.

10 questions

Take quiz

Values and variables

Judge how changing values are stored, when data is ready, and what const does and does not protect.

10 questions

Take quiz

If, else, and switch

Review decision rules, boundary coverage, branch priority, and the behavior a refactor must preserve.

12 questions

Take quiz

Functions in JavaScript

Review input and return contracts, shared calculations, and when a function should run.

11 questions

Take quiz

For, while, and do...while loops

Review termination, side-effect order, loop boundaries, and changes to repeated work.

12 questions

Take quiz

Commenting your JavaScript

Use comments to explain intent, temporarily disable code, and keep documentation consistent with behavior.

7 questions

Take quiz

Timers in JavaScript

Review scheduling, stale callbacks, cleanup, and assumptions about timing and rendering.

8 questions

Take quiz

Variable scope

Review state ownership, scope boundaries, and initialization before accepting a change.

10 questions

Take quiz

Closures

Review callback ownership, retained state, and whether closures preserve the intended behavior.

8 questions

Take quiz

Where JavaScript should live

Review shared-code contracts, deployment paths, loading dependencies, and cache freshness.

9 questions

Take quiz

Console logging

Log useful state, distinguish messages from thrown errors, and follow the code path that produced a warning.

7 questions

Take quiz

Variable and function hoisting

Review initialization order, early reads, and declaration changes that can break working code.

9 questions

Take quiz

Chrome DevTools for frontend work

Use browser evidence to test a diagnosis, inspect the failing state, and verify a lasting fix.

9 questions

Take quiz

FizzBuzz

Review overlapping rules, branch priority, and test coverage without requiring one code shape.

6 questions

Take quiz

Objects / OOP

Primitives, objects, and built-in types

Review value types, ordered collections, exact integers, and identity at API boundaries.

8 questions

Take quiz

Objects and prototype lookup

Review property contracts, shared state, prototype links, and the receiver of a method call.

12 questions

Take quiz

Working with strings

Index, combine, slice, split, and search text while handling boundaries and missing matches.

13 questions

Take quiz

Arrow functions

Choose concise or block bodies, handle parameters, and preserve the right this value in callbacks.

10 questions

Take quiz

Combining strings and variables

Build readable messages with concatenation and template literals, including punctuation and evaluated expressions.

7 questions

Take quiz

An ASCII pyramid

Build a centered console pyramid by relating row numbers, leading spaces, and repeated text.

7 questions

Take quiz

The 99-bottle countdown

Generate a countdown's repeated text while treating singular, zero, and final-reset cases correctly.

6 questions

Take quiz

The Devowelizer

Filter vowels from text while preserving the intended consonants, spacing, and case.

7 questions

Take quiz

When primitives use object methods

Review primitive method access, transformation results, wrapper identity, and metadata persistence.

7 questions

Take quiz

Numbers and Math

Use arithmetic, numeric notation, special Number values, and Math helpers with the right units and boundaries.

14 questions

Take quiz

Rounding numbers

Choose rounding direction, handle negative ties correctly, and scale values for decimal precision.

9 questions

Take quiz

Distance between two points

Turn horizontal and vertical differences into a straight-line distance with the Pythagorean theorem.

6 questions

Take quiz

Remapping values

Normalize a value, rescale it to another range, and handle reversed ranges and invalid inputs.

8 questions

Take quiz

Converting strings to numbers

Choose Number, parseInt, or parseFloat based on whether the whole string or a numeric prefix should count.

10 questions

Take quiz

Getters and setters

Use property syntax for computed reads and controlled writes, while watching backing state and inherited data.

9 questions

Take quiz

Random numbers in a range

Map random draws to inclusive integer ranges, recognize bias, and choose a suitable randomness source.

9 questions

Take quiz

Adding and removing object properties

Use dynamic keys, update nested objects, and distinguish deleting a property from assigning undefined.

7 questions

Take quiz

Classes and inheritance

Initialize instances, share prototype methods, and extend classes without duplicating their behavior.

11 questions

Take quiz

this, arrows, and bind

Trace method receivers and keep callbacks attached to the state they should update.

10 questions

Take quiz

Extending built-in objects

Understand prototype extensions and their effects on existing instances, other code, and future compatibility.

7 questions

Take quiz

Booleans and strict comparisons

Review flag parsing, presence checks, equality contracts, and object identity.

9 questions

Take quiz

null and undefined

Review absence contracts, readiness checks, nullish values, and shadowed bindings.

7 questions

Take quiz

JSON data

Read nested JSON, distinguish text from parsed values, and respect JSON's stricter syntax and value types.

12 questions

Take quiz

Sets and unique values

Store unique values, test membership, and understand iteration and object identity in a Set.

12 questions

Take quiz

Using Web Storage

Save and retrieve browser-side data while handling origins, string conversion, missing keys, and storage limits.

11 questions

Take quiz

Choosing browser storage

Choose cookies, localStorage, or sessionStorage based on server access, scope, and the lifetime your data needs.

8 questions

Take quiz

Arrays

Array essentials

Create arrays, read and replace indexed values, and choose the right method for adding, removing, or finding items.

12 questions

Take quiz

Looping through arrays

Choose indexed loops, for...of, or forEach with the right control flow, order, and sparse-array behavior.

11 questions

Take quiz

Map, filter, and reduce

Transform collections, select matching values, and combine results with callbacks that have clear contracts.

12 questions

Take quiz

Arrays are objects too

Separate indexed array entries from named properties and choose iteration that matches the data you need.

7 questions

Take quiz

Array indexes and holes

Reason about out-of-range access, sparse arrays, valid index keys, and the difference between absence and undefined.

11 questions

Take quiz

Practical array techniques

Copy, combine, sort, search, flatten, and transform arrays while keeping mutation and shallow-copy behavior clear.

18 questions

Take quiz

Shuffling an array

Trace Fisher–Yates swaps, shrinking random ranges, and the mutation contract of an in-place shuffle.

8 questions

Take quiz

Picking a random array item

Map a random sample to a valid array index and handle empty, sparse, or repeat-sensitive selections.

6 questions

Take quiz

Finding a middle index

Calculate a midpoint for whole arrays and subranges, with clear conventions for even and empty ranges.

6 questions

Take quiz

Swapping array entries

Exchange indexed values without losing data, package the swap as a helper, and avoid unintended prototype changes.

7 questions

Take quiz

Filtering a visible list

Connect checkbox state, category metadata, and CSS classes to show the right list items without deleting them.

12 questions

Take quiz

Remove duplicate arrays

Use serialization and Sets for suitable array data while recognizing reference identity and JSON's limits.

10 questions

Take quiz

Custom array behavior

Compare shared prototype extensions with explicit Array subclasses and trace construction and derived results.

9 questions

Take quiz

Cycling through arrays

Wrap array positions with counters and remainders, including offsets, subsets, and boundary cases.

9 questions

Take quiz

Two-dimensional arrays

Represent grids with nested arrays, choose a coordinate convention, and create independent rows and cells.

10 questions

Take quiz

Alphabetic sorting

Meet a sorting goal with explicit comparison rules and preserve the input when callers still need its original order.

6 questions

Take quiz

Summing an array

Accumulate numeric values and report a total without introducing off-by-one or string-concatenation bugs.

5 questions

Take quiz

The DOM

JavaScript, the browser, and the DOM

Connect page structure, styling, and behavior to the browser objects your code can read and change.

8 questions

Take quiz

Finding DOM elements

Choose selectors, handle missing matches, and distinguish one element from a static collection.

9 questions

Take quiz

Modifying DOM elements

Change text and attributes while keeping element references, classes, and input values straight.

8 questions

Take quiz

Setting CSS styles with JavaScript

Choose inline properties or reusable classes, then add, remove, and toggle styles without losing state.

10 questions

Take quiz

Traversing the DOM

Follow parents, siblings, and children without confusing element collections with all-node traversal.

9 questions

Take quiz

Creating, removing, and cloning elements

Place new nodes, move existing ones, remove subtrees, and choose the right depth when cloning.

11 questions

Take quiz

Adding many DOM elements

Build data-driven content with markup or fragments while preserving safety, identity, and clear update behavior.

9 questions

Take quiz

Dynamically creating a list

Turn topping data into a real list using JavaScript, with predictable ordering and safe text.

5 questions

Take quiz

CSS custom properties with JavaScript

Update parts of complex CSS values while keeping transforms, gradients, and their structure in CSS.

8 questions

Take quiz

Element and custom data attributes

Read and change attributes, use dataset, and decide which data belongs on an element.

9 questions

Take quiz

Emojis in HTML, CSS, and JavaScript

Use emoji characters and code points correctly while accounting for accessibility and platform differences.

7 questions

Take quiz

Generating random colors

Generate valid hex and HSL colors, constrain their ranges, and derive related colors from a shared choice.

12 questions

Take quiz

Viewport, screen, and document sizes

Choose the measurement that matches the page, window, or screen space you actually need.

8 questions

Take quiz

Working with URLs

Parse URL components and construct query parameters without confusing paths, ports, and encoded data.

10 questions

Take quiz

Picking colors with EyeDropper

Open a user-controlled color picker, await its result, and handle unsupported browsers or cancellation.

7 questions

Take quiz

Building an analog clock

Position clock hands, convert time into rotation, and adapt smooth motion to accessibility preferences.

14 questions

Take quiz

Events

JavaScript events

Register handlers, inspect event objects, and remove listeners using the same callback and capture setting.

9 questions

Take quiz

Event capture and bubbling

Trace an event's path and distinguish propagation, listener targets, and default actions.

11 questions

Take quiz

Mouse events

Choose click and hover events, read coordinates and buttons, and interpret wheel input correctly.

11 questions

Take quiz

Running code at the right time

Coordinate DOM readiness, resource loading, and classic script execution with defer and async.

10 questions

Take quiz

Navigating after a click

Wire buttons to the right destinations while respecting DOM readiness and native link behavior.

6 questions

Take quiz

Handling events for many elements

Delegate events to a shared parent while filtering targets and supporting dynamically added children.

9 questions

Take quiz

Working with keyboard events

Handle key presses, combinations, focus, and defaults using modern keyboard properties.

11 questions

Take quiz

Custom events

Create and dispatch application events, attach detail data, and understand synthetic-event limits.

9 questions

Take quiz

Loading scripts dynamically

Load code on demand, coordinate dependencies, and avoid misleading async-attribute assumptions.

8 questions

Take quiz

Preloading images

Prepare images before an interaction and track completion without confusing a request with readiness.

7 questions

Take quiz

Throttling chatty events

Limit expensive reactions to frequent events and choose frame-based or time-based scheduling deliberately.

7 questions

Take quiz

Detecting page inactivity

Reset an inactivity timer on input and distinguish a quiet page from proof that a user is absent.

8 questions

Take quiz

A custom cursor that follows the pointer

Keep a decorative follower in the right coordinate space and give its movement controlled visual lag.

6 questions

Take quiz

Building Guess the Number

Keep a stable answer, validate guesses, and update form feedback without losing game state.

12 questions

Take quiz

Building a digital clock

Read system time, format a twelve-hour display, and update it without relying on fixed frame timing.

10 questions

Take quiz

Building a Caesar cipher

Shift lowercase letters with wraparound, validate input, and keep the output synchronized with message changes.

13 questions

Take quiz

Eyes that follow the pointer

Turn pointer coordinates into eye rotation and a gentle tilt while keeping coordinate spaces consistent.

6 questions

Take quiz

Detecting a timed key sequence

Track ordered key presses, reset failed attempts, and enforce the pause between successive keys.

9 questions

Take quiz

Building a todo list

Add entries through a form, preserve their identities, and remove the selected item safely.

7 questions

Take quiz

Detecting browser zoom changes

Understand viewport measurements, custom zoom notifications, and the limits of a resize-based heuristic.

10 questions

Take quiz

Device Stuff

Making HTTP requests

Fetch data asynchronously, inspect HTTP outcomes, parse response bodies, and recognize equivalent XMLHttpRequest steps.

12 questions

Take quiz

Finding a click's position

Match coordinate spaces, account for element geometry, and position a marker at the clicked point.

9 questions

Take quiz

Detecting mouse movement direction

Compare consecutive positions, handle unchanged axes, and avoid mistaking initialization or scrolling for motion.

7 questions

Take quiz

Checking a resource URL

Use lightweight HTTP probes without confusing failures, blocked access, or server fallbacks with file existence.

7 questions

Take quiz

Controlling an audio element

Connect playback, progress, seeking, volume, and mute controls while handling media readiness and failures.

12 questions

Take quiz

Building a press-and-hold gesture

Track an active press, cancel pending work, signal completion, and animate progress without assuming a fixed refresh rate.

12 questions

Take quiz

Building a draggable element

Track drag state and accumulated offsets, preserve the grab point, and handle movement beyond the original target.

11 questions

Take quiz

Detecting touch capability

Distinguish touch support from the user's current input and preserve mixed-input experiences.

6 questions

Take quiz

Displaying a webcam stream

Request camera access responsibly, attach a MediaStream to video, and stop capture cleanly.

10 questions

Take quiz

Detecting fonts by text measurement

Compare canvas text widths against a fallback and understand why the result is a heuristic, not an installed-font inventory.

8 questions

Take quiz

Recognizing touch swipe direction

Compare touch positions, select a dominant axis, and reset gesture state without confusing tiny movements or cancelled contacts.

10 questions

Take quiz

Displaying a random API photo

Turn a photo response into a matching image and photographer credit, with safe rendering and failure handling.

6 questions

Take quiz

Generating a random sound

Build an oscillator-to-gain audio graph, choose random sound parameters, and manage playback and cleanup.

11 questions

Take quiz

The KIRUPA Newsletter

Thought provoking content that lives at the intersection of design 🎨, development 🤖, and business 💰 - delivered weekly to over a bazillion subscribers!

SUBSCRIBE NOW

Creating engaging and entertaining content for designers and developers since 1998.

Follow:

Popular

Loose Ends

:: Copyright KIRUPA 2026 //--