Core Modules & CLI

Preview — 3 of 10 questions

What best describes Node.js?

javascript
// server.js (Node.js code)
const http = require("http");

const server = http.createServer((req, res) => {
  res.writeHead(200, { "Content-Type": "text/plain" });
  res.end("Hello from Node.js!");
});

server.listen(3000, () => {
  console.log("Server running on port 3000");
});
AA JavaScript framework for building websites.
BA JavaScript runtime environment for executing JavaScript outside the browser.
CA database management system.
DA CSS preprocessor.

What is npm?

javascript
npm init              # Create package.json
npm install           # Install all dependencies
npm install lodash    # Install specific package
npm install -D jest   # Install as dev dependency
npm uninstall lodash  # Remove a package
npm update            # Update packages to latest versions
npm run start         # Run script defined in package.json
npm list              # Show installed packages
AA programming language.
BThe package manager for Node.js, used to install and manage dependencies.
CA server runtime environment.
DA CSS framework.

What does the following code do?

javascript
const http = require("http");

const server = http.createServer((req, res) => {
  res.writeHead(200, { "Content-Type": "text/plain" });
  res.end("Hello, World!");
});

server.listen(3000);
ACreates a database connection.
BCreates an HTTP server that listens on port 3000 and responds with "Hello, World!"
CCreates a client connection.
DCreates a file system watcher.

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.