Open Web Developer Advocate at Google • Tools, Performance, Animation, UX
By Meggin Kearney
Meggin is a Tech Writer
By Flavio Copes
Flavio is a Full Stack Developer
Console logging is a powerful way to inspect what your page or application does. Let's start with console.log() and explore other advanced usage.
Use console.log() for basic logging
Use console.error() and console.warn() for eye-catching stuff
Use console.group() and console.groupEnd() to group related messages and avoid clutter
Use console.assert() to show conditional error messages
Writing to the console
Use the console.log() method for any basic logging to the console. It takes one or more expressions as parameters and writes their current values to the console, concatenating multiple parameters into a space-delimited line.
console.log("Node count:", a.childNodes.length, "and the current time is:", Date.now());