medium.com 6 min read Original Source

How to Debug JavaScript Right Inside Your Chrome Browser

Do you still use console log to debug your JavaScript code?

As a part of my first internship, I was working on a web-based application. Like any other modern web application, the application that I was working on used JavaScript on the Frontend. Being a less experienced JS developer, I was having a tough time finding a bug in my code.

This is when I request a senior developer for assistance. Finding a ton of console.log in my code, the senior developer gave me a piece of advice that changed my JS development workflow. This story conveys the same advice.

Logging to Debug

To debug a piece of code, it is a common practice to print variables and messages. A developer can understand the code flow and verify that variables are receiving expected values with the help of these messages.

Presence or absence of a log message also indicates whether or not a specific region of the code was executed. This method of debugging is undeniably effective, and many developers use it to debug code in the early stages of their careers.