JS Debugging
- console.assert() - Writes a message to the console, but only if an expression evaluates to false.
- console.clear() - Clears the console.
- console.count() - Write to the console the number of times that particular console.count() is called.
- console.dir() - Recognizes the object as an object and prints it's properties in the form of a clean expandable list.
- console.error() - Outputs an error message to the console.
- console.group() / groupEnd() - It's possible to group messages to avoid spam and mess in the console.
- console.info() - Writes a message to the console.
- console.log() - Writes (logs) a message to the console.
- console.table() - Print a visually nice table representation of an object.
- console.time() - Starts a timer (can track how long an operation takes).
- console.timeEnd() - Stops a timer that was previously started by console.time().
- console.warn() - Outputs a warning message to the console.
CSS styling the console
Use %c before a string. Example :
console.log('%cString','CSS')