← 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);
}
- A.TypeError
- B.SyntaxError
- C.RangeError
- 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 →