Example 1 — Example
Trigger or inspect.
JavaScript
try { JSON.parse("{"); } catch (e) { console.log(e.name); }How It Works
- Run the snippet.
- Inspect the error name.
SyntaxError — Code cannot be parsed (invalid syntax). Often thrown by eval/JSON.parse.
try { JSON.parse("{"); } catch (e) { console.log(e.name); }Trigger or inspect.
try { JSON.parse("{"); } catch (e) { console.log(e.name); }CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
6 people found this page helpful