How to read a JavaScript error in the browser console
The console tells you what broke and where. You only have to know where to look.
Open the console
In Chrome, Edge and Firefox press F12 (or Ctrl+Shift+J on Windows, Cmd+Option+J on a Mac) and choose the Console tab. In Safari, enable the Develop menu in settings first. Reload the page with the console open, because errors that happen while the page loads are only shown if the console was already open.
Read the message in two parts
A console error has a type and a message, for example Uncaught TypeError: Cannot read properties of undefined (reading 'name'). The word Uncaught only says that no code caught it. The type (TypeError, ReferenceError, SyntaxError, RangeError) gives the family of the problem, and the message gives the detail. The details are specific: in this example, something was undefined and the code tried to read name from it.
Follow the link on the right
On the right of the message is the file name and line number, such as app.js:12. Click it: the Sources tab opens at that line. Click the arrow at the left of the error to expand the stack trace, the list of functions that were running. The top entry is where the error was thrown, and the entries below are the callers.
Add a breakpoint instead of guessing
Click the line number in the Sources tab to set a breakpoint, reload, and the page pauses on that line. You can hover over any variable to see its value, or type its name in the console. You can step to the next line with F10. This is the fastest way to find which value is undefined.
Errors that are not in your code
- A red line saying
Failed to load resource: 404means a file or address does not exist. Look at the Network tab. Access to fetch ... blocked by CORS policyis a security rule of the browser, not a bug in the syntax. See the page on CORS.- Warnings in yellow do not stop the page. Deal with red errors first.
- Errors that mention
chrome-extension://come from your extensions, not from the page. Try a private window with extensions off.
The Network tab
When something fails to load or an API returns something odd, open the Network tab, reload, and click the request. The Headers part shows the status code and address, the Response part shows what the server sent. An error page where you expected data is the most common explanation of "Unexpected token <" errors.
Different browsers, different words
Chrome, Edge and Node share an engine and word errors the same way. Firefox and Safari use different words for the same problems, for instance for reading a property of undefined. When you search, include the exact message of the browser you use, and when you read advice written for another browser, expect small differences in wording.
Why does an error show twice?
The page code may have run twice, or one error is the original and the other is a message about a promise that was not handled.
How do I clear the console?
Press Ctrl+L in the console, or click the clear icon.
This is an independent guide. It is not connected with Python, Microsoft, Google, GitHub or the Git project. Product names belong to their owners. Examples were run on 13 November 2026 in a practice folder or a blank workbook; your version may word a message slightly differently.