Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 1.25 KB

Part-2-Core_NodeJS_Debugger.md

File metadata and controls

39 lines (28 loc) · 1.25 KB

INTRO TO Core Node JS debugger:

Node.js provides built-in non-graphic debugging tool that can be used on all platforms. It provides different commands for debugging Node.js application.

🏝️ Now, considering an example where we add two numbers

 const add= (a, b) => {
    return a+b;
    
 }
 const result = add(3,4)
 console.log(result) 

🎻 store this file as add.js , Now in command promt type

node debug add.js

🎻 This command start debugging and stops at the first line as shown below:

💡 Command used in core debugger:

  • cont, c - Continue execution
  • next, n - Step next
  • step, s - Step in
  • out, o - Step out
  • watchers - See the value of all expressions and variables added into watch.
  • Pause - Pause running code.
  • watch().

🗝️ now by using watch command it will return the result

watch('result')

💊 In this output it shows undefined as it is executed before the result is defined.

🗝️ Thus the final output :