Skills101
← All practice quizzes

Quiz: Error Handling and Debugging

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Handle failures gracefully with try, catch, finally and throw, know the built-in error types, write custom error classes, catch errors in async code, and find bugs fast with the console and browser DevTools.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What does this print?

    try {
      console.log("A");
      null.x;
      console.log("B");
    } catch (e) {
      console.log("C");
    } finally {
      console.log("D");
    }
    
  2. Question 2

    What does this print?

    function f() {
      try { return "try"; }
      finally { console.log("cleanup"); }
    }
    console.log(f());
    
  3. Question 3

    What does this print?

    try {
      JSON.parse("{bad}");
    } catch (e) {
      console.log(e.name);
    }
    
  4. Question 4

    Which error type do you get from undefined.length?

  5. Question 5

    Why throw new Error("…") instead of throw "failed"?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →