Node.js · Junior · Question 70 of 75
What is JSON.parse likely to do with invalid input?
- 1Return
null - ✓Correct answer: Throw a
SyntaxError - 3Return an empty object
Explanation
When parsing data from files, requests or other services, wrap JSON.parse in try/catch, or the error will crash your handler.