The Window.console
property returns a reference to the console
object, which provides methods for logging information to the browser's console. These methods are intended for debugging purposes only and should not be relied on for presenting information to end users.
The first example logs text to the console.
console.log("An error occurred while loading the content");
The next example logs an object to the console, with the object's fields expandable using disclosure widgets:
For more examples, see the Examples section of the console
article.
Note: Currently there are many implementation differences among browsers, but work is being done to bring them together and make them more consistent with one another.