80 Javascript Trivia Questions with Answers
80 public questions with answers, drawn from the well. How many can you answer?
This JavaScript trivia hub tests the language from everyday syntax to engine and runtime details. Questions cover array methods such as reduce, modern operators introduced in ES2020, event propagation, file extensions, Number.MAX_SAFE_INTEGER, Node.js binary data, and the internal handling of JavaScript code by V8.
The mix works for beginners learning the language and experienced developers refreshing important facts. You might identify the method that collapses an array into one value, recall the bit width of JavaScript’s Number type, or name the V8 interpreter. It fits coding bootcamps, classroom reviews, developer meetups, technical interview practice, and programming-themed quiz rounds.
Which method prevents an event from propagating to parent elements?
Answer
stopPropagation
What is the value of Number.MAX_SAFE_INTEGER?
Answer
9007199254740991
What is the bit width of the JavaScript Number type?
Answer
64 bits
What is the name of the interpreter in the V8 JavaScript engine?
Answer
Ignition
Which method is used to get the prototype of an object?
Answer
Object.getPrototypeOf()
Which keyword is used to throw a custom error?
Answer
throw
What is the value of 2 + '2' in JavaScript?
Answer
"22"
What does the typeof operator return for a function?
Answer
"function"
Which method converts a JavaScript value to a JSON string?
Answer
JSON.stringify
What is the purpose of 'use strict' directive?
Answer
Enables strict mode
What does the 'arguments' object contain in a non-arrow function?
Answer
All passed arguments
What does the spread operator (...) do when used in function calls?
Answer
Expands an array into individual arguments
What does Math.floor() do to a number?
Answer
Rounds down to the nearest integer
Which method is used to attach an event handler to an element in the DOM?
Answer
addEventListener
Which JavaScript method reverses the order of elements in an array?
Answer
reverse()
In what year was ECMAScript 6 finalized?
Answer
2015
Which property holds the smallest positive JavaScript number?
Answer
Number.MIN_VALUE
What is the name of the optimizing compiler in V8?
Answer
TurboFan
Which static method creates an object with a given prototype?
Answer
Object.create()
What does NaN === NaN evaluate to?
Answer
false
Which loop iterates over iterable objects like arrays?
Answer
for...of
What is the server-side JavaScript runtime built on V8?
Answer
Node.js
Which built-in object handles dates and times?
Answer
Date
Which method joins all array elements into a string?
Answer
join()
Which method removes the last element from an array?
Answer
pop()
In ES2020, what operator is denoted by ?? and handles null/undefined?
Answer
nullish coalescing operator
What is the JavaScript engine used in Firefox?
Answer
SpiderMonkey
Javascript trivia — quick answers
What are good JavaScript trivia questions?
Strong JavaScript trivia questions cover syntax, arrays, objects, asynchronous programming, browser events, ECMAScript history, Node.js, and engine behavior. Examples include identifying reduce, the nullish coalescing operator, stopPropagation, Number.MAX_SAFE_INTEGER, JavaScript file extensions, and the V8 engine’s interpreter.
How hard is JavaScript trivia?
It ranges from beginner to advanced. Beginners can answer questions about file extensions and common array methods. Intermediate questions involve event propagation, operators, promises, and Node.js APIs. Advanced questions may cover numeric precision, execution engines, prototypes, coercion, typed arrays, and ECMAScript specification details.
What does the JavaScript reduce method do?
The reduce method runs a callback over an array and combines the elements into one accumulated result. The result can be a number, string, object, array, or another value, depending on the callback. An optional initial value determines the accumulator’s starting state and helps avoid edge cases with empty arrays.
What is the nullish coalescing operator in JavaScript?
The nullish coalescing operator is written as ?? and returns its right-hand operand only when the left-hand operand is null or undefined. Unlike the logical OR operator, it does not replace other falsy values such as 0, false, or an empty string.
What is Number.MAX_SAFE_INTEGER?
Number.MAX_SAFE_INTEGER is 9,007,199,254,740,991, also written as 2^53 − 1. It is the largest integer that JavaScript can represent and compare reliably using the Number type. Larger exact integers may require BigInt or another appropriate numeric representation.
What does stopPropagation do?
The stopPropagation method prevents an event from continuing through the DOM event path to other ancestor or descendant targets, depending on the event phase. It does not prevent other listeners on the same element from running; stopImmediatePropagation is used when those listeners must also be stopped.