See the Console API Reference to browse the full list of console methods. See Get Started With Logging Messages to get hands-on experience with logging. Inspecting the values of variables at a certain moment in time.Making sure that code is executing in the right order.Web developers log messages for 2 general reasons: Try to figure out which lines of code caused the browser to log the messages. querySelector ( 'h2' ), 'h2 not found!' ) įigure 1 shows what the Console looks like after loading the page and waiting 3 seconds. For example, suppose that you're in the process of writing the HTML and JavaScript for a page: Ĭonst h1 = document. When the browser executes your JavaScript and sees an expression like that, it knows that it's supposed to log the message to the Console. To log a message, you insert an expression like console.log('Hello, Console!') into your JavaScript. Web developers often log messages to the Console to make sure that their JavaScript is working as expected. The Console has 2 main uses: viewing logged messages and running JavaScript. ![]() ![]() This page explains how the Chrome DevTools Console makes it easier to develop web pages.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |