When writing JSON.parse("hi")
getting the following error:
Uncaught SyntaxError: Unexpected token 'h', "hi" is not valid JSON
When writing JSON.parse("foo")
getting the following error:
Uncaught SyntaxError: Unexpected token 'o', "foo" is not valid JSON
Why is f letter ignored?
CodePudding user response:
JSON.parse("false")
is acceptable, so it's reading the "f" as a potential start of the "false" string, but failing when the next character isn't "a".