Javascript - Reading Error Messages
Code Life
By Pierre Marsaa
The Message Is a Clue
Beginners often panic when an error message pops up and start changing random lines of code.
Experienced developers do the opposite: they read the message carefully. An error message tells you what went wrong and which word in your code caused the crash:
↗️
Loading editor...
↶
↷
Run the code above and look at the red message:
TypeError: Cannot read properties of undefined (reading 'toUpperCase')
Every JavaScript error message is split into two parts separated by a colon (:):
1.
The error type (TypeError) — The general family of problem.
2.
The description (Cannot read properties of undefined (reading 'toUpperCase')) — Exactly what failed.
Verify