💻 Programming
100 JavaScript Quiz Questions & Answers 2026
JavaScript fundamentals, ES6, React, Node.js, TypeScript and modern JS concepts
Ready to test your knowledge?
Take the Quiz →
JavaScript Basics — 25 Questions
- Who created JavaScript? (Brendan Eich — created in 10 days in 1995 at Netscape)
- What is JavaScript's official name? (ECMAScript — JavaScript is the brand name)
- What does "use strict" do? (Enables strict mode — catches common coding mistakes)
- What is the difference between var, let, and const? (var = function-scoped, hoisted; let = block-scoped; const = block-scoped, immutable binding)
- What are JavaScript data types? (string, number, boolean, null, undefined, object, symbol, bigint)
- What is null vs undefined? (null = intentional empty value; undefined = variable declared but not assigned)
- What is type coercion? (Automatic conversion of data types — "5" + 3 = "53")
- What is === vs ==? (=== checks value AND type; == only checks value with coercion)
- What is a closure? (Function with access to its outer scope even after outer function returns)
- What is hoisting? (Variable/function declarations moved to top of scope before execution)
- What is the DOM? (Document Object Model — tree representation of HTML elements)
- How do you select an element in JS? (document.getElementById(), querySelector(), etc.)
- What is an event listener? (element.addEventListener("click", function) — runs function on event)
- What is a callback function? (Function passed as argument to another function)
- What is the difference between synchronous and asynchronous code? (Synchronous blocks execution; asynchronous runs without blocking)
- What is a Promise? (Object representing eventual success or failure of async operation)
- What is async/await? (Syntax for writing async code that looks synchronous)
- What is the event loop? (JS mechanism handling async code in a single thread)
- What is JSON.parse()? (Converts JSON string to JavaScript object)
- What is JSON.stringify()? (Converts JavaScript object to JSON string)
- What is the spread operator (...)? (Expands iterable elements — [...arr1, ...arr2])
- What is destructuring? (Extract values from arrays/objects — const {name} = person)
- What are template literals? (Backtick strings with embedded expressions — `Hello ${name}`)
- What is an arrow function? (const fn = () => expression — shorter function syntax)
- What is a prototype? (Every JS object has a prototype — basis of JS inheritance)
Modern JavaScript & Frameworks — 25 Questions
- What is Node.js? (JavaScript runtime built on Chrome's V8 engine — runs JS outside browser)
- What is npm? (Node Package Manager — manages JavaScript dependencies)
- What is React? (Meta's UI library for building component-based interfaces)
- What is Vue.js? (Progressive JavaScript framework for building UIs)
- What is Angular? (Google's full-featured TypeScript framework for SPAs)
- What is TypeScript? (Superset of JavaScript with static typing)
- What is Next.js? (React framework for server-side rendering and full-stack apps)
- What is a Single Page Application (SPA)? (Web app loading single HTML page and updating dynamically)
- What is state in React? (Data that changes over time and triggers re-renders)
- What is a React hook? (Function starting with "use" — useState, useEffect, etc.)
- What is Redux? (State management library for JavaScript apps)
- What is Webpack? (Module bundler for JavaScript applications)
- What is Babel? (Transpiler converting modern JS to browser-compatible code)
- What is REST vs GraphQL? (REST: fixed endpoints; GraphQL: flexible queries)
- What is Express.js? (Minimal Node.js web framework)
- What is JSX? (A syntax extension for JavaScript used in React to write HTML-like code)
- What is a "component" in React? (A reusable, self-contained piece of UI)
- What is "props" in React? (Data passed from a parent component to a child component)
- What is the useEffect hook used for in React? (Performing side effects like data fetching after render)
- What is Vite? (A fast build tool and development server for modern web projects)
- What is Tailwind CSS? (A utility-first CSS framework for rapid UI styling)
- What is Svelte? (A compiler-based JavaScript framework that builds highly efficient apps)
- What is a "virtual DOM" in React? (An in-memory representation of the UI used to optimize rendering)
- What is npm's package.json file used for? (Defining project metadata and dependencies)
JavaScript Syntax & Arrays — 25 Questions
- What does the .map() array method do? (Creates a new array by applying a function to each element)
- What does the .filter() array method do? (Creates a new array with elements that pass a test)
- What does the .reduce() array method do? (Reduces an array to a single value using an accumulator)
- What does the .forEach() array method do? (Executes a function once for each array element)
- What does .push() do to an array? (Adds one or more elements to the end of the array)
- What does .pop() do to an array? (Removes and returns the last element of the array)
- What does .shift() do to an array? (Removes and returns the first element of the array)
- What does .slice() do to an array? (Returns a shallow copy of a portion of the array)
- What does .splice() do to an array? (Adds or removes elements from an array at a specific index)
- What does .includes() check for in an array? (Whether an array contains a specific value)
- What does .indexOf() return? (The index of the first occurrence of a value, or -1 if not found)
- What does .join() do to an array? (Combines all elements into a single string, separated by a delimiter)
- What does .sort() do to an array by default? (Sorts elements as strings in ascending order)
- What is the difference between null and NaN? (null is an intentional absence of value; NaN means "Not a Number")
- What does typeof return for an array? ("object")
- What is a template string used for? (Embedding expressions inside string literals using backticks)
- What is the ternary operator in JavaScript? (condition ? valueIfTrue : valueIfFalse)
- What does the && operator do in a boolean expression? (Returns true only if both operands are true)
- What does the || operator do in a boolean expression? (Returns true if at least one operand is true)
- What is optional chaining (?.) used for? (Safely accessing nested object properties without errors if undefined)
- What is the nullish coalescing operator (??)? (Returns the right-hand value only if the left is null or undefined)
- What does Array.isArray() check? (Whether a given value is an array)
- What is an IIFE? (Immediately Invoked Function Expression — a function that runs as soon as it's defined)
- What does Object.keys() return? (An array of a given object's own property names)
- What is "this" in JavaScript generally referring to? (The object that is executing the current function, depending on context)
Web APIs & Performance — 25 Questions
- What is the Fetch API used for? (Making HTTP requests from JavaScript in the browser)
- What is localStorage used for? (Storing data in the browser persistently across sessions)
- What is sessionStorage used for? (Storing data in the browser for the duration of a page session)
- What is the difference between localStorage and cookies? (localStorage holds more data and isn't sent with every HTTP request, unlike cookies)
- What is CORS? (Cross-Origin Resource Sharing — a security feature controlling cross-domain requests)
- What is debouncing in JavaScript performance optimization? (Delaying a function's execution until after a pause in repeated calls)
- What is throttling in JavaScript performance optimization? (Limiting how often a function can run over time)
- What is lazy loading? (Deferring the loading of resources until they're needed)
- What is the Web Storage API used for broadly? (Storing key-value data in the browser, via localStorage and sessionStorage)
- What is a Web Worker? (A script that runs in the background, separate from the main thread)
- What is the purpose of "defer" on a script tag? (Delaying script execution until after the HTML is parsed)
- What is minification in web performance? (Removing unnecessary characters from code to reduce file size)
- What is a Service Worker used for? (Enabling offline functionality and caching for web apps)
- What does "tree shaking" do in JavaScript bundling? (Removes unused code from the final bundle)
- What is the Document Object Model's relationship to JavaScript? (JavaScript can read and manipulate the DOM to update the page dynamically)
- What is a "race condition" in asynchronous JavaScript? (When the outcome depends on the unpredictable timing of async operations)
- What does Promise.all() do? (Waits for all given promises to resolve, or rejects if any fail)
- What is event bubbling in the DOM? (An event propagating from the target element up through its ancestors)
- What is event delegation? (Attaching a single event listener to a parent to manage events from child elements)
- What is the purpose of preventDefault() in event handling? (Stopping the default browser action for an event)
- What is WebSocket used for? (Enabling real-time, two-way communication between client and server)
- What is the Critical Rendering Path in web performance? (The sequence of steps the browser takes to render a page)
- What is a Progressive Web App (PWA)? (A web app that behaves like a native app, supporting offline use and installability)
- What is the purpose of a polyfill? (Providing modern functionality in older browsers that lack native support)
- What does "use client" or similar directives signal in modern frameworks like Next.js? (That a component should be rendered on the client side)
- What is the purpose of ESLint in JavaScript projects? (Identifying and fixing problems in code style and quality)
❓ Frequently Asked Questions
Why is JavaScript the most important web language?
JavaScript is the only programming language that runs natively in web browsers, making it essential for front-end development. It also runs on servers (Node.js), mobile (React Native), and desktop apps (Electron).
What is the difference between JavaScript and Java?
Despite the name similarity, they are completely different languages. Java is compiled, statically typed, and used for enterprise/Android. JavaScript is interpreted, dynamically typed, and used for web.
🎯 Practice Quizzes — Programming
Ready to test what you learned? Pick a quiz below and challenge yourself:
Easy
🔥 1
Programming Basics
🚀 Play Now →
Easy
🔥 0
Basic Programming Concepts
🚀 Play Now →
Easy
🔥 0
Introduction to Coding Logic
🚀 Play Now →
Easy
🔥 0
HTML, CSS and Web Basics
🚀 Play Now →
Easy
🔥 0
Programming for Kids and Beginners
🚀 Play Now →
Hard
🔥 0
Advanced Web and System Design
🚀 Play Now →
Easy
🔥 0
Web Development Basics
🚀 Play Now →
Medium
🔥 0
Python Programming Fundamentals
🚀 Play Now →
Medium
🔥 0
Intermediate Python
🚀 Play Now →
Medium
🔥 0
Data Structures and Algorithms
🚀 Play Now →
Ready to Test Your Programming Knowledge?
Take our Programming quiz and see how you rank against players worldwide!