Console
There are a few different ways to run JavaScript code. The easiest to get started is to use the browser console; open the development tools and the console tab.
When creating a web application, you can use console.*
to output information to the browser console.
Console is a very handy tool for quickly debugging problems.
Interestingly, there is no specification for how console.*
methods behave in ECMAScript. Each browser (environment) adds its own methods and behavior. However, almost all environments support the following:
-
Logging information such as printing out a message or the current value of a variable
console.log("This is my message");
-
Sending a warning to the console.
console.warn("Resource not changed")
-
Sending an error message to the console.
console.error("File not found!")
You should not include any
console.*
methods in production code.