As per Hofstadter’s Law, it always takes longer than we expect to implement any development feature. Bugs are a byproduct of code. On a lighter note, the number of lines of code is directly proportional to number of bugs. So, debugging is one of the essential skills every developer should have. The more knowledge about the local variables and flow of control, the easier it is to triage bugs and fix them.
Log to console:
global.console.log(“This is a wanderers web debug post !”)
Throwing Exceptions to understand data or application flow is another way to debug an application. If you are shipping logs to a different application (log file, data dog etc), exception message can be seen there otherwise it can be found on console.
Below shows an example to throw exception:
Throw Error(“This is a wanderers web debug post !”);
Debug with IDE:
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"name": "Launch Program",
"preLaunchTask": "tsc: build - tsconfig.json",
Debugging is one of the most underrated skill to learn a new language. Above techniques can be used to understand existing Node.js application or implement a greenfield project.