JavaScript Debugging

It is difficult to write JavaScript code without a debugger. Your code might contain syntax errors, or logical errors, that are difficult to diagnose. Often, when JavaScript code contains errors, nothing will happen. There are no error messages, and you will get no indications where to search for errors.

JavaScript Debuggers

Debuggin is not an easy task, but now most of the modern browser have a built in debugger for JavaScript with a debugger we can follow how the values of variables are changing based on how the code is being executed. We can also set break points to stop the execution of the code in a desired point, or we can follow the execution of our programs step by step using the different functionalities this debugger offer us to help us verify the behavior of our programs.

Console log function

There is a function that allows us to see in our console the value of any variable, or object in a JavaScript program this function is the console.log(); function


How to open the debugging console

You can open your debbuging console by clicking on F12 key or the Shift + Ctrl + J keys in a PC, for Mac this accomplished in the following way Command + Option + J

debugger image