Challenge - 5 Problems
Node.js Debugger Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
How to start the Node.js built-in debugger?
Which command correctly starts the Node.js built-in debugger for a script named
app.js?Attempts:
2 left
💡 Hint
Think about the original command to launch the built-in CLI debugger.
✗ Incorrect
The node debug app.js command starts the built-in CLI debugger in Node.js. The other options relate to the newer inspector protocol or break on start.
❓ component_behavior
intermediate2:00remaining
What happens when you use
debugger; in Node.js code?If you run a Node.js script with the built-in debugger and the code contains a
debugger; statement, what will happen when execution reaches that line?Node.js
console.log('Start'); debugger; console.log('End');
Attempts:
2 left
💡 Hint
Think of
debugger; as a breakpoint in the code.✗ Incorrect
The debugger; statement causes Node.js to pause execution when running under the debugger, allowing inspection and commands before continuing.
📝 Syntax
advanced2:00remaining
Identify the correct command to start Node.js debugger and break on first line
Which command starts the Node.js built-in debugger and pauses execution on the first line of
server.js?Attempts:
2 left
💡 Hint
Look for the correct flag to break on the first line with the built-in debugger.
✗ Incorrect
The --brk flag tells the debugger to break on the first line. It must come before the script name.
🔧 Debug
advanced2:00remaining
What error occurs if you run
node debug without a script?What error message or behavior occurs when you run
node debug without specifying a script file?Attempts:
2 left
💡 Hint
Think about what the debugger expects as input.
✗ Incorrect
The built-in debugger requires a script file to debug. Running without one shows a usage error.
❓ state_output
expert3:00remaining
What is the output of this Node.js debugger session?
Given the code below and running
node debug test.js, what is the output after typing repl and then x + y in the debugger?Node.js
const x = 5; const y = 10; debugger; console.log(x + y);
Attempts:
2 left
💡 Hint
Variables declared before the debugger statement are accessible in the REPL.
✗ Incorrect
When paused at debugger;, the REPL can access variables in scope. x + y evaluates to 15.