From the course: Learning Chrome Web Developer Tools

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Write information to the Console

Write information to the Console - Chrome Tutorial

From the course: Learning Chrome Web Developer Tools

Start my 1-month free trial

Write information to the Console

- [Instructor] The project for this video includes code that generates console messages to simulate working with a large number of them. I notice as I scroll through these messages that most start with Type B or Type C but some start with undefined which often means the code was passed a reference to a nonexistent value. In my editor, I have simulate.js open which contains the code that generates these messages. It uses a couple Math.random statements to select a type from an array and then generate a value for the level. Notice that the last line of the for statement uses console.log, which is the statement that generates a generic informational message in the console. Console.log messages can also be useful in debugging. If the results of your code are not what you expect, you can add console.log statements at various points to track how the value is modified by different statements and hopefully pinpoint where…

Contents