Example 1 — Example
Trigger or inspect.
JavaScript
try { console.log(notDefinedVar); } catch (e) { console.log(e.name); }How It Works
- Run the snippet.
- Inspect the error name.
ReferenceError — Referencing a variable that does not exist / TDZ violations.
try { console.log(notDefinedVar); } catch (e) { console.log(e.name); }Trigger or inspect.
try { console.log(notDefinedVar); } 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