Recall & Review
beginner
What does the
node command do?The
node command runs JavaScript files outside the browser using the Node.js runtime.Click to reveal answer
beginner
How do you run a script named
app.js using Node.js?You run it by typing
node app.js in the terminal or command prompt.Click to reveal answer
intermediate
What happens if you run
node without any file name?Node.js opens an interactive REPL (Read-Eval-Print Loop) where you can type JavaScript commands and see results immediately.
Click to reveal answer
intermediate
Can you run a script with Node.js if the file is not in the current directory?
Yes, you provide the relative or absolute path to the file, like
node ./scripts/app.js or node /home/user/app.js.Click to reveal answer
advanced
What is the purpose of the
--inspect flag when running a Node.js script?The
--inspect flag starts the script with debugging enabled, allowing you to connect a debugger to inspect the code while it runs.Click to reveal answer
How do you start running a JavaScript file named
server.js with Node.js?✗ Incorrect
The correct command to run a JavaScript file with Node.js is
node filename.What does Node.js open if you run
node without any arguments?✗ Incorrect
Running
node alone opens the interactive REPL where you can type JavaScript commands.Which of these commands runs a script located in a subfolder called
scripts?✗ Incorrect
You specify the relative path to the script like
node scripts/app.js.What does the
--inspect flag do when running a Node.js script?✗ Incorrect
The
--inspect flag enables debugging so you can connect a debugger.If your script file is named
index.js, which command is correct to run it?✗ Incorrect
You must include the full filename with extension:
node index.js.Explain how to run a JavaScript file using Node.js from the terminal.
Think about the command format: node + filename
You got /3 concepts.
Describe what happens when you run the
node command without any script file.It’s like a mini JavaScript playground in your terminal.
You got /3 concepts.