Vidyalelo
JavaScript · Q27

Parsing, Benchmarking And Logging

Programming · JavaScript · question 27

Q27

What kind of an exception will be thrown if the string to parse is not valid JSON?

A.
SyntaxError
Answer
B.
ArrayOutOfBoundException
C.
Both SyntaxError and ArrayOutOfBoundException
D.
None of the mentioned

Answer: Option A

Solution

Answer: Option A
Solution:
The method JSON.parse()throws a SyntaxError exception if the string to parse is not valid JSON.