In this lesson, students will learn:
- How to get information about an error in the console
A statement makes up the logical set of instructions that tells the browser what to do. The word
alert() is a function and,
'hello world' is a string.
The most basic method to track JavaSrcipt errors is to consult the web browser. Most web browsers record in a separate window called an error console. When you load a web page that contains an error, you can then view the console to get helpful information about the error, such as, which line of the web page it occurred in and out and a description of the error.
Keyboard shortcut: Ctrl+Shift+J (Windows) or ⌘-Option-J (Mac).
Internet Explorer Console
Press the F12 key to open the developer tools, and press it again to close them.
On Windows click the Firefox tab in the top left of the browser window and choose Web Developer⟶Web Console. On Mac, select Tools⟶Web Developer⟶Web Console.
Keyboard shortcut: Ctrl+Shift+I (Windows) or ⌘-Option-K (Mac).
Safari Error Console
Developer menu: Developer⟶Show Error Console. Keyboard shortcut: ⌘-Option-C (Mac).