JS Debugging

  1. console.assert() - Writes a message to the console, but only if an expression evaluates to false.
  2. console.clear() - Clears the console.
  3. console.count() - Write to the console the number of times that particular console.count() is called.
  4. console.dir() - Recognizes the object as an object and prints it's properties in the form of a clean expandable list.
  5. console.error() - Outputs an error message to the console.
  6. console.group() / groupEnd() - It's possible to group messages to avoid spam and mess in the console.
  7. console.info() - Writes a message to the console.
  8. console.log() - Writes (logs) a message to the console.
  9. console.table() - Print a visually nice table representation of an object.
  10. console.time() - Starts a timer (can track how long an operation takes).
  11. console.timeEnd() - Stops a timer that was previously started by console.time().
  12. console.warn() - Outputs a warning message to the console.


CSS styling the console

Use %c before a string. Example :

console.log('%cString','CSS')