console.log() for debugging. It allows you to log debug information to the console (on most browsers).
If you log large amounts of debug information, it is hard to interpret your console output effectively. In fact, you probably make this even worse by wrapping even more debug information around what you’re looking for, to help identify it! e.g.
console.group() allows you to (go on, guess) group your console output:
console.groupEnd() allows you to terminate logging to the currently defined console group:
The big hitter, collapse your group by default with
console.groupCollapsed() instead of
Objects and arrays
If you’re logging objects and/or arrays in your groups, there’s another winner for you in the form of
See the jsfiddle here - ensure you open the console, then click run.
Happy, clean debugging!