🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Error Handling and Debugging: all 10 questions

Quiz: Error Handling and Debugging · Question 3 of 10

What does this print? (code)

What does this print?

try {
  JSON.parse("{bad}");
} catch (e) {
  console.log(e.name);
}
  1. A.TypeError
  2. B.SyntaxError
  3. C.RangeError
  4. D.JSONError
Answer & explanation

Correct answer: SyntaxError

Invalid JSON makes JSON.parse throw a SyntaxError.

Can you get the rest right without peeking?

Take the timed Quiz: Error Handling and Debugging quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →