0
0
Node.jsframework~20 mins

Node.js built-in debugger in Node.js - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Node.js Debugger Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2: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?
Anode --inspect app.js
Bnode --debug-brk app.js
Cnode debug app.js
Dnode --inspect-brk app.js
Attempts:
2 left
💡 Hint
Think about the original command to launch the built-in CLI debugger.
component_behavior
intermediate
2: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');
AThe <code>debugger;</code> line is ignored and execution continues immediately.
BExecution pauses and waits for debugger commands before continuing.
CThe script throws a syntax error and stops.
DExecution skips the <code>debugger;</code> line and logs only 'End'.
Attempts:
2 left
💡 Hint
Think of debugger; as a breakpoint in the code.
📝 Syntax
advanced
2: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?
Anode debug --brk server.js
Bnode debug --break server.js
Cnode debug server.js --break
Dnode --inspect server.js
Attempts:
2 left
💡 Hint
Look for the correct flag to break on the first line with the built-in debugger.
🔧 Debug
advanced
2: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?
AError: No script specified. Usage: node debug <script.js>
BSyntaxError: Unexpected end of input
CThe debugger starts but immediately exits with no message.
DReferenceError: script is not defined
Attempts:
2 left
💡 Hint
Think about what the debugger expects as input.
state_output
expert
3: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);
AReferenceError: x is not defined
BSyntaxError: Unexpected identifier
Cundefined
D15
Attempts:
2 left
💡 Hint
Variables declared before the debugger statement are accessible in the REPL.