How you can improve your workflow using the JavaScript console

 

As a web developer, you know very well the need to debug your code. We often use external libraries for logs, and to format and/or display…

How you can improve your workflow using the JavaScript console

Please meet:

  • console.group() (or console.groupCollapsed() if we want it to be closed by default). Then add a console.groupEnd()
  • The console.table allows us to visualize these structures inside a beautiful table where we can name the columns and pass them as parameters.
  • Console.count, Console.time and Console.timeEnd

    These three methods are the Swiss army knife for every developer who needs to debug. The console.count counts and outputs the number of times that count() has been invoked on the same line and with the same label. The console.time starts a timer with a name specified as an input parameter, and can run up to 10,000 simultaneous timers on a given page. Once initiated, we use a call to console.timeEnd to stop the timer and print the elapsed time to the Console.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.