NB-21 · 3 Nov 2026 · Practice
Learn
Reading a browser error in the console
When a page does nothing after a click, the first place to look is the browser's developer console, not a search for the whole error string.
Open the console, reproduce the click, and read the first red message of that attempt. The useful parts are the exception name (TypeError, ReferenceError), the text (often "cannot read properties of undefined" or "is not a function"), and the file and line number on the right. Click the file and line. The highlighted line is where the program actually stopped, which may be one step after the real mistake.
If the message says a value is undefined, log the object you thought you had, one line above the failure, and look at it. Do not "fix" the error by wrapping the line in a try/catch until you know why the value is missing. A caught error that you do not understand is still a broken program, only quieter.
Stack traces list callers below the failing line. When the failing line is inside a library, walk down the stack until you see a file you wrote. That is usually the call that passed a bad argument.