LearnFrenzy
Sign in Take a free test

JavaScript Programming · Practice by type

JavaScript Programming MCQ Questions and Answers

Multiple-choice questions on JavaScript Programming concepts and common errors, topic by topic, each with the answer and a clear explanation.

  • 735 questions
  • 25 topics
  • Answers checked on a real compiler

JavaScript Basics 30 questions

  1. Which engine runs JavaScript in Chrome and Node.js? Easy
  2. Which statement about JavaScript is true? Easy
  3. JavaScript and ECMAScript Easy
  4. defer vs async Medium
  5. Which name is a valid identifier? Easy
  6. Which word is reserved? Medium
  7. Nested block comments Medium
  8. Automatic Semicolon Insertion Medium
  9. What does "use strict" do? Easy
  10. Code that is always strict Hard
  11. typeof a function Easy
  12. Return value of console.log Medium
  13. Template literal syntax Easy
  14. document in Node.js Medium
  15. When is a SyntaxError reported? Hard
  16. Error: unexpected end of input Easy
  17. Error: apostrophe inside a single-quoted string Easy
  18. Error: identifier has already been declared Medium
  19. Error: missing initializer in const Medium
  20. Error: duplicate parameter names in strict mode Hard
  21. Error: commenting out code that has a comment Medium
  22. Error: console.Log Easy
  23. Error: variable name with the wrong case Easy
  24. Error: a line that starts with ( Hard
  25. Error: a line that starts with [ Hard
  26. Error: undeclared variable in strict mode Medium
  27. Error: assignment to a const Medium
  28. Bug: numbers stored as strings Easy
  29. Bug: = inside an if condition Medium
  30. Bug: returning an object on the next line Medium

Variables: var, let and const 30 questions

  1. Scope of a var variable Easy
  2. Scope of let and const Easy
  3. Which keyword allows redeclaration? Easy
  4. What does const guarantee? Medium
  5. The temporal dead zone Medium
  6. Which statement about hoisting is correct? Medium
  7. Top-level declarations and window Hard
  8. Which declaration must be initialised? Easy
  9. Object.freeze and nested objects Hard
  10. Recommended declaration style Easy
  11. typeof on a variable in the TDZ Hard
  12. let in a for loop Medium
  13. Assigning without a declaration Medium
  14. const as a classic for-loop counter Hard
  15. Shadowing a let with a var Hard
  16. Error: let and var with the same name Medium
  17. Error: var inside a block shadowing a let Hard
  18. Error: the same let in two switch cases Hard
  19. Error: let as the body of an if without braces Hard
  20. Error: using a let before its declaration Easy
  21. Error: an inner let shadows the outer variable too early Hard
  22. Error: a const used as a running total Medium
  23. Error: const as a for-loop counter Medium
  24. Error: using a block-scoped const outside its block Easy
  25. Error: changing a frozen object in strict mode Hard
  26. Error: typeof on a let before its declaration Hard
  27. Bug: every button reports the same index Medium
  28. Bug: the total stays 0 Easy
  29. Bug: nested loops without let Hard
  30. Bug: the global discount is ignored Hard

Data Types 30 questions

  1. How many primitive types? Easy
  2. Which is not a primitive? Easy
  3. Checking for null Medium
  4. The type of NaN Easy
  5. Number.MAX_SAFE_INTEGER Medium
  6. Which value is truthy? Easy
  7. Meaning of null and undefined Easy
  8. Detecting an array Medium
  9. isNaN vs Number.isNaN Hard
  10. Mixing BigInt and Number Medium
  11. Strings are immutable Medium
  12. Comparing two objects Medium
  13. Symbol uniqueness Medium
  14. How numbers are stored Easy
  15. How does "abc".length work? Hard
  16. Error: a BigInt with a decimal point Medium
  17. Error: misplaced numeric separator Hard
  18. Error: a variable name that starts with a digit Easy
  19. Error: calling a method on a number literal Medium
  20. Error: adding a Number to a BigInt Medium
  21. Error: reading a property of null Easy
  22. Error: a missing nested object Easy
  23. Error: joining a symbol to a string Hard
  24. Error: a string method on a number Easy
  25. Error: BigInt() of a decimal Hard
  26. Error: JSON.stringify with a BigInt Hard
  27. Bug: empty input accepted as a number Hard
  28. Bug: comparing a decimal sum exactly Medium
  29. Bug: typeof-based type detection Medium
  30. Bug: changing the "copy" changes the original Easy

Operators 30 questions

  1. == vs === Easy
  2. The % operator Easy
  3. Associativity of ** Medium
  4. What does && return? Medium
  5. ?? vs || Medium
  6. Optional chaining Easy
  7. Postfix vs prefix increment Easy
  8. null >= 0 vs null == 0 Hard
  9. The in operator Medium
  10. The conditional (ternary) operator Easy
  11. Mixing ?? with || Hard
  12. Unary plus Easy
  13. delete on an array element Hard
  14. How instanceof decides Medium
  15. Object.is vs === Hard
  16. Error: ?? combined with || Hard
  17. Error: incrementing a literal Medium
  18. Error: a negative number raised to a power Hard
  19. Error: assigning to an expression Medium
  20. Error: assigning through optional chaining Hard
  21. Error: the in operator on a string Hard
  22. Error: instanceof with an object on the right Hard
  23. Error: unary plus on a BigInt Hard
  24. Error: optional chaining in the wrong place Medium
  25. Bug: a volume of 0 is ignored Medium
  26. Bug: adding numbers stored as strings Easy
  27. Bug: the average is too high Easy
  28. Bug: every temperature is "comfortable" Medium
  29. Bug: a missing score is graded "Fail" Medium
  30. Bug: an invalid number is not detected Easy

Conditional Statements 30 questions

  1. How switch compares values Easy
  2. A case without break Easy
  3. Where can default go? Medium
  4. How many branches run? Easy
  5. if ("false") Easy
  6. Which if does the else belong to? Medium
  7. Why write switch (true)? Medium
  8. Ternary vs if Easy
  9. A let declared inside an if Easy
  10. Evaluation of case expressions Hard
  11. What is a guard clause? Medium
  12. Lookup tables Medium
  13. if (x = 5) Medium
  14. Optional chaining in a condition Easy
  15. case NaN Hard
  16. Error: unexpected token else Medium
  17. Error: condition without parentheses Easy
  18. Error: elif instead of else if Easy
  19. Error: two default clauses Medium
  20. Error: a case without a colon Easy
  21. Error: checking a property of a missing object Easy
  22. Error: a condition on an undeclared variable Easy
  23. Error: calling a missing method in a condition Medium
  24. Error: switch on a property of null Medium
  25. Error: using a block variable before it is declared Medium
  26. Bug: every size costs the same Easy
  27. Bug: big orders get the small discount Easy
  28. Bug: zero stock reported as unknown Medium
  29. Bug: every menu choice is invalid Medium
  30. Bug: logged-in users are asked to log in Hard

Loops 30 questions

  1. Which loop always runs at least once? Easy
  2. What does for…in give you? Easy
  3. for…of on a plain object Easy
  4. break inside forEach Medium
  5. What does continue do? Easy
  6. Labelled break Medium
  7. An infinite for loop Easy
  8. for…in on arrays Medium
  9. Order of object keys Hard
  10. Index and value in for…of Easy
  11. let in a for loop head Medium
  12. return inside forEach Medium
  13. forEach and holes Hard
  14. Which method stops at the first match? Medium
  15. Iterating a string with an emoji Hard
  16. Error: break inside forEach Medium
  17. Error: commas instead of semicolons in for Easy
  18. Error: break to a label that does not exist Medium
  19. Error: continue outside a loop Medium
  20. Error: do without while Easy
  21. Error: for…of over a plain object Easy
  22. Error: for…of over null Medium
  23. Error: forEach on an object Easy
  24. Error: reading one element past the end Medium
  25. Error: for…of over a number Medium
  26. Bug: the total is NaN Easy
  27. Bug: summing an array with for…in Medium
  28. Bug: some even numbers survive Medium
  29. Bug: a search function always returns undefined Medium
  30. Bug: the countdown never runs Easy

Functions 30 questions

  1. Which function can be called before its definition? Easy
  2. When does a default parameter apply? Medium
  3. Where must the rest parameter go? Easy
  4. arguments in arrow functions Medium
  5. A function without return Easy
  6. First-class functions Easy
  7. Higher-order functions Easy
  8. Purpose of an IIFE Medium
  9. fn.length with defaults Hard
  10. How arguments are passed Medium
  11. Missing and extra arguments Easy
  12. Named function expressions Hard
  13. Pure functions Medium
  14. What is a callback? Easy
  15. When are defaults evaluated? Hard
  16. Error: rest parameter before another parameter Easy
  17. Error: duplicate parameter names with a default Hard
  18. Error: an arrow function returning an object Medium
  19. Error: a function declaration without a name Medium
  20. Error: "use strict" in a function with defaults Hard
  21. Error: calling a var function expression too early Medium
  22. Error: calling a const arrow function too early Medium
  23. Error: calling what a factory forgot to return Medium
  24. Error: recursion without a base case Medium
  25. Error: a required argument is missing Easy
  26. Bug: the area is undefined Easy
  27. Bug: a 0% discount becomes 10% Medium
  28. Bug: printing the function instead of its result Easy
  29. Bug: a recursive sum returns undefined Medium
  30. Bug: a "copy" function changes the original Hard

Scope and Hoisting 30 questions

  1. What does lexical scope mean? Medium
  2. Direction of the scope chain Easy
  3. Kinds of scope Easy
  4. What is hoisted completely? Easy
  5. Are classes hoisted? Medium
  6. The creation phase Hard
  7. A name found in no scope Easy
  8. Who can see whose variables? Easy
  9. var at the top of an ES module Hard
  10. What is a closure? Medium
  11. Scope vs this Hard
  12. globalThis Medium
  13. Reaching a shadowed variable Medium
  14. Hoisting of a var function expression Medium
  15. Avoiding globals Easy
  16. Error: let with the same name as a parameter Medium
  17. Error: a class declared twice Medium
  18. Error: a const and a function with the same name Hard
  19. Error: redeclaring the catch parameter Hard
  20. Error: using another function's local variable Easy
  21. Error: creating an object before its class Medium
  22. Error: a function reads a let that is not initialised yet Hard
  23. Error: using a let loop counter after the loop Easy
  24. Error: a block reads its own variable too early Medium
  25. Error: calling a nested helper from outside Easy
  26. Bug: the price shows the wrong currency Medium
  27. Bug: a helper resets the app counter Medium
  28. Bug: a saved rule uses a later discount Hard
  29. Bug: a later function silently replaces the first Hard
  30. Bug: the minimum salary is ignored Medium

Arrays 30 questions

  1. What does new Array(3) create? Medium
  2. What does push return? Easy
  3. slice vs splice Easy
  4. How does sort() compare by default? Medium
  5. Reading the last element Easy
  6. Setting length Medium
  7. typeof an array Easy
  8. Finding NaN Hard
  9. Array.of vs the Array constructor Medium
  10. Comparing arrays Easy
  11. fill with an object Hard
  12. Which method changes the array? Medium
  13. push vs unshift on large arrays Hard
  14. toSorted() Medium
  15. What can Array.from convert? Medium
  16. Error: missing comma in an array literal Easy
  17. Error: destructuring declaration without a value Medium
  18. Error: rest element before another element Medium
  19. Error: a trailing comma after the rest element Hard
  20. Error: an array with a negative length Medium
  21. Error: pushing to a property that is not an array Easy
  22. Error: reassigning a const array Easy
  23. Error: an array method on a string Medium
  24. Error: destructuring undefined Medium
  25. Error: pushing to a frozen array Hard
  26. Bug: the wrong student is ranked first Easy
  27. Bug: marking one seat books a whole column Hard
  28. Bug: the backup changes too Easy
  29. Bug: identical answers marked wrong Medium
  30. Bug: the first role is not recognised Medium

Strings 30 questions

  1. Are strings mutable? Easy
  2. Which quotes interpolate? Easy
  3. Why is an emoji's length 2? Hard
  4. charAt vs [] out of range Medium
  5. slice vs substring with negative numbers Medium
  6. Why is "a" < "B" false? Medium
  7. What is localeCompare for? Medium
  8. String(x) vs x.toString() Medium
  9. new String("hi") Medium
  10. What can go inside ${ }? Easy
  11. Tagged templates Hard
  12. String.raw Hard
  13. Building a long string Medium
  14. includes vs indexOf Easy
  15. Escape for a new line Easy
  16. Error: mismatched quotes Easy
  17. Error: a line break inside a quoted string Easy
  18. Error: an unclosed ${ placeholder Medium
  19. Error: an invalid Unicode escape Hard
  20. Error: an octal escape in strict mode Hard
  21. Error: reversing a string directly Easy
  22. Error: trimming a missing value Easy
  23. Error: repeat with a negative count Medium
  24. Error: an invalid code point Hard
  25. Error: an unknown normalisation form Hard
  26. Bug: an update is not offered Medium
  27. Bug: "yes" is not accepted Easy
  28. Bug: a correct username is rejected Easy
  29. Bug: the replacement does not appear Easy
  30. Bug: the character counter is too high Hard

Objects 30 questions

  1. Reading a property whose name is in a variable Easy
  2. Computed property names Easy
  3. Number keys Medium
  4. What does delete return? Medium
  5. in vs Object.hasOwn Medium
  6. freeze vs seal Medium
  7. How deep does spread copy? Medium
  8. this in a method call Easy
  9. Comparing two objects Easy
  10. What JSON.stringify leaves out Medium
  11. Getters Medium
  12. Object.create(null) Hard
  13. What Object.entries returns Easy
  14. Defaults of Object.defineProperty Hard
  15. Object.assign and its target Medium
  16. Error: missing comma between properties Easy
  17. Error: mixing method and arrow syntax Medium
  18. Error: a getter with a parameter Hard
  19. Error: a setter without a parameter Hard
  20. Error: a hyphen in an unquoted key Easy
  21. Error: Object.keys on null Medium
  22. Error: a detached method in strict mode Hard
  23. Error: redefining a locked property Hard
  24. Error: JSON with single quotes Medium
  25. Error: stringifying a circular object Hard
  26. Bug: every lookup returns undefined Easy
  27. Bug: editing a draft changes the saved profile Medium
  28. Bug: an item with zero stock is "not in the catalogue" Medium
  29. Bug: the total contains text Hard
  30. Bug: a default setting disappears Medium

Array Methods 30 questions

  1. What does map return? Easy
  2. What does filter keep? Easy
  3. reduce on an empty array Medium
  4. What does forEach return? Easy
  5. find vs filter Easy
  6. every on an empty array Hard
  7. map(parseInt) Hard
  8. Default depth of flat Medium
  9. What flatMap does Medium
  10. When nothing matches Easy
  11. Which method changes the array? Medium
  12. Arguments passed to callbacks Easy
  13. The accumulator in reduce Easy
  14. findLast Medium
  15. Is sort stable? Hard
  16. Error: returning an object from a map callback Medium
  17. Error: unclosed call Easy
  18. Error: continue inside a callback Medium
  19. Error: await inside a normal callback Hard
  20. Error: reduce on an empty cart Medium
  21. Error: mapping a missing API field Easy
  22. Error: passing a string instead of a function Medium
  23. Error: using the result of find without a check Medium
  24. Error: sorting when a name is missing Hard
  25. Error: map on a Set Medium
  26. Bug: quantities become NaN Medium
  27. Bug: the discounted prices are undefined Easy
  28. Bug: the order total is a strange string Hard
  29. Bug: admin panel shown to everyone Medium
  30. Bug: names are not sorted Medium

String Methods 30 questions

  1. replace with a string pattern Easy
  2. replaceAll with a regex Hard
  3. padStart Easy
  4. What does trim remove? Easy
  5. The limit argument of split Medium
  6. match with the g flag Medium
  7. matchAll Hard
  8. search vs indexOf Medium
  9. Natural sorting Medium
  10. Why normalize? Hard
  11. $1 in a replacement Medium
  12. The position argument of includes Medium
  13. Regex flags Easy
  14. test() with a global regex Hard
  15. Which method returns a boolean? Easy
  16. Error: an unterminated regex literal Medium
  17. Error: an unclosed group Medium
  18. Error: an unknown regex flag Hard
  19. Error: two groups with the same name Hard
  20. Error: replaceAll with a non-global regex Hard
  21. Error: matchAll without g Hard
  22. Error: a RegExp built from raw user input Medium
  23. Error: indexing a null match Medium
  24. Error: padStart on a number Easy
  25. Error: splitting a missing value Easy
  26. Bug: only one space is replaced Easy
  27. Bug: the course is not found Easy
  28. Bug: "1+1" is never replaced Hard
  29. Bug: chapter 10 comes before chapter 2 Medium
  30. Bug: names with double spaces do not match Medium

ES6 Features 30 questions

  1. The official name of ES6 Easy
  2. typeof a class Easy
  3. super() in a derived constructor Medium
  4. Private fields Medium
  5. Static members Easy
  6. Map keys Medium
  7. Set and objects Medium
  8. WeakMap Hard
  9. What makes an object iterable? Medium
  10. Generators Medium
  11. yield vs return in a generator Hard
  12. Default and named exports Medium
  13. Properties of ES modules Medium
  14. Symbol keys Medium
  15. Using a class Hard
  16. Error: the function keyword inside a class Easy
  17. Error: super() in a class that extends nothing Medium
  18. Error: reading a private field from outside Medium
  19. Error: yield in a normal function Medium
  20. Error: two constructors Medium
  21. Error: import in a classic script Hard
  22. Error: calling a class like a function Easy
  23. Error: this before super() Medium
  24. Error: a primitive WeakMap key Hard
  25. Error: new Symbol() Medium
  26. Error: spreading an object into an array Medium
  27. Bug: Map entries go missing Medium
  28. Bug: duplicate users survive a Set Medium
  29. Bug: the count is 0 Hard
  30. Bug: a copied object loses its methods Hard

Arrow Functions 30 questions

  1. When is the value returned automatically? Easy
  2. Returning an object literal Easy
  3. Where does an arrow get this? Medium
  4. arguments inside an arrow Medium
  5. new with an arrow function Medium
  6. An arrow as an object method Medium
  7. call, apply and bind with arrows Hard
  8. Are arrow functions hoisted? Medium
  9. A good place for an arrow function Easy
  10. A bad place for an arrow function Medium
  11. The prototype property Hard
  12. Parentheses around one parameter Easy
  13. A line break before => Hard
  14. Class-field arrow functions Hard
  15. Arrow generators Hard
  16. Error: a line break before => Hard
  17. Error: two parameters without parentheses Easy
  18. Error: a generator arrow Hard
  19. Error: duplicate parameters in an arrow Hard
  20. Error: return in an expression body Easy
  21. Error: an arrow used as a constructor Medium
  22. Error: an arrow method that uses this Medium
  23. Error: an arrow on a prototype Hard
  24. Error: calling a const arrow too early Easy
  25. Error: a regular callback inside a class method Medium
  26. Bug: every price is undefined Easy
  27. Bug: the full name is "undefined undefined" Medium
  28. Bug: call() does not set the name Hard
  29. Bug: mapping ids to objects gives undefined Medium
  30. Bug: arrows do not fix the var loop Medium

Destructuring 30 questions

  1. How patterns match values Easy
  2. When does a default apply? Easy
  3. Renaming syntax Easy
  4. Rename and default together Medium
  5. Where can the rest element go? Easy
  6. Destructuring null Medium
  7. Destructuring into existing variables Hard
  8. Skipping items Easy
  9. What object rest collects Medium
  10. When defaults are evaluated Hard
  11. Variables from a nested pattern Hard
  12. Why "= {}" after a parameter pattern? Medium
  13. Destructuring iterables Medium
  14. Swapping variables Easy
  15. An array pattern on an object Medium
  16. Error: object rest before another property Easy
  17. Error: destructuring assignment without parentheses Hard
  18. Error: a destructuring declaration without a value Medium
  19. Error: a default on the rest element Hard
  20. Error: a number as a destructuring target Medium
  21. Error: destructuring a null result Easy
  22. Error: calling a destructured function without an argument Medium
  23. Error: an array pattern on a plain object Medium
  24. Error: a nested pattern over a missing object Medium
  25. Error: a default that uses a later variable Hard
  26. Error: a swap without semicolons Hard
  27. Bug: the renamed variable is undefined Medium
  28. Bug: the default avatar is not used Easy
  29. Bug: the setting does not change Medium
  30. Bug: the sanitised copy changes the original Hard

Spread and Rest Operators 30 questions

  1. Spread or rest? Easy
  2. How deep is an array spread copy? Medium
  3. Which value wins? Easy
  4. Spreading null Hard
  5. Rules for rest parameters Easy
  6. Rest parameters vs arguments Medium
  7. Math.max with an array Easy
  8. Spreading a string Easy
  9. Conditional spread Medium
  10. What object spread copies Hard
  11. Spread vs Object.assign Hard
  12. Spreading an object into an array Medium
  13. undefined in a merge Medium
  14. Object rest in destructuring Easy
  15. Spreading a huge array into a call Hard
  16. Error: a trailing comma after a rest parameter Hard
  17. Error: two rest parameters Easy
  18. Error: spread on its own Easy
  19. Error: a rest parameter without parentheses Medium
  20. Error: a pattern after object rest Hard
  21. Error: spreading an object into an array Easy
  22. Error: spreading null into an array Medium
  23. Error: spreading undefined into a call Easy
  24. Error: spreading millions of numbers into Math.max Hard
  25. Error: object rest from null Medium
  26. Bug: the old state changes too Medium
  27. Bug: an empty form field erases the default Medium
  28. Bug: the Set has only one item Hard
  29. Bug: a new tag becomes letters Medium
  30. Bug: user choices are ignored Easy

Closures 30 questions

  1. What is a closure? Easy
  2. When is a closure created? Medium
  3. What does a closure capture? Medium
  4. Two calls of a factory Easy
  5. Closures from the same call Medium
  6. Fixing the loop closure problem Easy
  7. Privacy with closures Easy
  8. Closures and memory Hard
  9. The module pattern Medium
  10. When can captured data be freed? Hard
  11. Stale closures Hard
  12. Closures and this Hard
  13. Memoization Easy
  14. IIFE in a var loop Medium
  15. A counter's third call Easy
  16. Error: an unclosed factory Easy
  17. Error: ++ in a parameter list Medium
  18. Error: an expression inside an object literal Medium
  19. Error: an IIFE without parentheses Medium
  20. Error: returning the API object from an arrow Medium
  21. Error: incrementing a captured const Easy
  22. Error: calling the object a factory returned Easy
  23. Error: calling a closure before its variable is ready Medium
  24. Error: memoize called without a function Medium
  25. Error: reading a private variable from outside Easy
  26. Bug: every menu item opens the last page Easy
  27. Bug: separate counters share a count Medium
  28. Bug: the report always says 0 items Hard
  29. Bug: power(2, 10) returns 8 Medium
  30. Bug: reset does not reset Easy

Callbacks 30 questions

  1. What is a callback? Easy
  2. Is the forEach callback asynchronous? Easy
  3. setTimeout with 0 ms Easy
  4. Error-first callbacks Easy
  5. Callback hell Easy
  6. Avoiding callback hell Medium
  7. Inversion of control Hard
  8. Passing a callback correctly Easy
  9. Extra arguments to setTimeout Medium
  10. this inside a callback Medium
  11. Sometimes sync, sometimes async Hard
  12. try/catch and async callbacks Hard
  13. promisify Medium
  14. Order of parallel callbacks Medium
  15. Callbacks vs promises Medium
  16. Error: a missing ) in nested callbacks Easy
  17. Error: function keyword with => Medium
  18. Error: a reserved word as a parameter name Medium
  19. Error: two parameters with the same name Medium
  20. Error: calling a function without its callback Easy
  21. Error: passing the result of a call as the callback Easy
  22. Error: ignoring the error argument Medium
  23. Error: throwing inside a timer callback Hard
  24. Error: a string passed to setTimeout Hard
  25. Error: using a callback's parameter outside it Easy
  26. Bug: success runs after a failure Medium
  27. Bug: the result is undefined Easy
  28. Bug: the welcome message appears twice Medium
  29. Bug: files are listed in the wrong order Hard
  30. Bug: the page renders stale content Hard

Promises 30 questions

  1. The states of a promise Easy
  2. When does the executor run? Medium
  3. Calling resolve twice Medium
  4. What then returns Medium
  5. Returning a promise from then Medium
  6. Where should catch go? Easy
  7. What finally receives Medium
  8. Promise.all with one failure Medium
  9. Promise.allSettled Medium
  10. race vs any Hard
  11. then vs setTimeout Medium
  12. Unhandled rejections Hard
  13. Promise.resolve of a promise Hard
  14. Thenables Hard
  15. The explicit-construction anti-pattern Hard
  16. Error: an unclosed then Easy
  17. Error: await in a normal function Medium
  18. Error: a semicolon in the middle of a chain Medium
  19. Error: async after the arrow parameters Hard
  20. Error: passing resolve and reject as separate arguments Medium
  21. Error: new Promise without an executor Medium
  22. Error: calling then on a function that returns nothing Easy
  23. Error: a rejection nobody handles Hard
  24. Error: Promise.all with separate arguments Hard
  25. Error: Promise.any of an empty list Hard
  26. Bug: the total is undefined Easy
  27. Bug: "Order saved" appears before the order is saved Medium
  28. Bug: "done" is printed before the work Medium
  29. Bug: shipping an order that failed to load Hard
  30. Bug: nothing happens for out-of-stock items Hard

Async/Await 30 questions

  1. What an async function returns Easy
  2. Where await is allowed Easy
  3. What await pauses Medium
  4. Handling a rejected await Easy
  5. return vs return await inside try Hard
  6. Running awaits in parallel Medium
  7. forEach with async callbacks Medium
  8. Top-level await Medium
  9. The synchronous part of an async function Medium
  10. Awaiting a plain value Medium
  11. An uncaught error in an async function Medium
  12. async arrow syntax Easy
  13. await Promise.all with a failure Medium
  14. Async constructors Hard
  15. for await…of Hard
  16. Error: await in a forEach callback Medium
  17. Error: top-level await in a script Medium
  18. Error: an async constructor Hard
  19. Error: an async getter Hard
  20. Error: await used as a variable name Hard
  21. Error: an async function whose rejection nobody handles Medium
  22. Error: using an async result without await Easy
  23. Error: bad JSON inside an async function Medium
  24. Error: await Promise.all without error handling Medium
  25. Error: awaiting a method that does not exist Easy
  26. Bug: the price prints as a Promise Easy
  27. Bug: the page loads twice as slowly as needed Medium
  28. Bug: the order total is 0 Medium
  29. Bug: the fallback is never used Hard
  30. Bug: every user is treated as an admin Medium

Event Loop 30 questions

  1. What the event loop does Easy
  2. Which callback is a microtask? Easy
  3. Single-threaded JavaScript Easy
  4. What setTimeout(fn, 0) means Medium
  5. How many microtasks run per turn Medium
  6. Microtask starvation Hard
  7. A long synchronous loop Medium
  8. When the Promise executor runs Medium
  9. process.nextTick vs promises Hard
  10. Node.js event loop phases Hard
  11. setImmediate vs setTimeout(0) Hard
  12. When the browser renders Medium
  13. try/catch around setTimeout Medium
  14. Web Workers Medium
  15. How await resumes Medium
  16. Error: await inside a setTimeout callback Medium
  17. Error: an "async" arrow that is not async Hard
  18. Error: yield inside a timer callback Hard
  19. Error: the callback is called immediately Easy
  20. Error: a string passed to setTimeout Medium
  21. Error: try/catch around setTimeout Medium
  22. Error: a failure inside queueMicrotask Medium
  23. Error: using a value set by a timer Easy
  24. Bug: the progress timer never ticks Medium
  25. Bug: the result list is empty Easy
  26. Bug: the spinner appears after the data Medium
  27. Bug: the Cancel button is ignored Hard
  28. Bug: the app reports "not ready" Medium
  29. Bug: the log order changes on the second call Hard
  30. Bug: await does not wait Medium

DOM Manipulation 30 questions

  1. What the DOM is Easy
  2. querySelector with no match Easy
  3. Showing user input Medium
  4. Live and static collections Medium
  5. Event delegation Medium
  6. Order of event phases Medium
  7. preventDefault vs stopPropagation Medium
  8. Reading a data attribute Easy
  9. Attribute vs property Hard
  10. Why use a DocumentFragment Medium
  11. DOMContentLoaded vs load Medium
  12. The defer attribute Medium
  13. Removing an event listener Medium
  14. innerHTML += and listeners Hard
  15. childNodes vs children Medium
  16. Error: assigning through optional chaining Medium
  17. Error: a dashed name on dataset Medium
  18. Error: an unclosed addEventListener call Easy
  19. Error: the selector does not match Easy
  20. Error: a # in getElementById Easy
  21. Error: forEach on getElementsByClassName Medium
  22. Error: map on querySelectorAll Medium
  23. Error: appendChild with an HTML string Medium
  24. Error: a number method on a data attribute Medium
  25. Bug: a comment injects an image with a script Medium
  26. Bug: the Like button stops working Medium
  27. Bug: delete removes "undefined" Hard
  28. Bug: only some finished tasks are cleared Hard
  29. Bug: the active tab is not detected Easy
  30. Bug: the progress bar does not grow Medium

Error Handling 30 questions

  1. When finally runs Easy
  2. Reading a property of null Easy
  3. Using an undeclared variable Easy
  4. Catching a SyntaxError Medium
  5. Why throw Error objects Medium
  6. Writing a custom error Medium
  7. return inside finally Hard
  8. error.cause Medium
  9. AggregateError Medium
  10. catch without a parameter Easy
  11. Ordering instanceof checks Medium
  12. try/catch and promises Medium
  13. Converting an error to a string Easy
  14. Empty catch blocks Easy
  15. Global error handlers Hard
  16. Error: try on its own Easy
  17. Error: two parameters in catch Medium
  18. Error: a line break after throw Hard
  19. Error: a custom error without super() Medium
  20. Error: a custom error class called without new Medium
  21. Error: a variable from try used in catch Medium
  22. Error: a broken cleanup in finally Hard
  23. Error: a bug inside the catch block Easy
  24. Error: re-throwing the wrong name Medium
  25. Bug: the port is silently undefined Easy
  26. Bug: the custom error prints as "Error" Medium
  27. Bug: validation errors get the generic message Medium
  28. Bug: the error is printed as a result Medium
  29. Bug: the logs never show why loading failed Medium
  30. Bug: the spinner never disappears after an error Medium

JavaScript Output Questions 15 questions

  1. typeof typeof Easy
  2. Which comparison is true? Easy
  3. The type of NaN Easy
  4. 0.1 * 3 Medium
  5. "10" + 1 - 1 Medium
  6. [] == false Medium
  7. Which value is truthy? Easy
  8. Math.max with an array Medium
  9. The length of an emoji Hard
  10. new Array(3) as a string Medium
  11. Unary plus on an object Medium
  12. Comparing numeric strings Medium
  13. delete on an array element Medium
  14. let a = b = 5 Hard
  15. Default sort on numbers Easy

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links