Bird
0
0

What will be the output in Chrome DevTools console if you run Node.js with node --inspect app.js and set a breakpoint inside a function that logs 'Hello'?

medium📝 component behavior Q4 of 15
Node.js - Debugging and Profiling
What will be the output in Chrome DevTools console if you run Node.js with node --inspect app.js and set a breakpoint inside a function that logs 'Hello'?
A'Hello' logs immediately without pausing
BNo output appears because debugging is disabled
CNode.js crashes due to missing --inspect-brk flag
DExecution pauses at the breakpoint allowing inspection; 'Hello' logs after resume
Step-by-Step Solution
Solution:
  1. Step 1: Understand behavior of --inspect with breakpoints

    --inspect enables debugging; breakpoints pause execution at specified lines.
  2. Step 2: Predict output when breakpoint is hit

    Execution pauses at breakpoint; after resuming, 'Hello' logs to console.
  3. Final Answer:

    Execution pauses at the breakpoint allowing inspection; 'Hello' logs after resume -> Option D
  4. Quick Check:

    Breakpoint pauses execution = Execution pauses at the breakpoint allowing inspection; 'Hello' logs after resume [OK]
Quick Trick: Breakpoints pause code; logs appear after resuming [OK]
Common Mistakes:
  • Thinking logs appear before pause
  • Assuming crash without --inspect-brk
  • Believing debugging is off without flags

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Node.js Quizzes