Interview Q&A / Node.js

INTERVIEW Q&A · 68 QUESTIONS

Node.js interview questions

The event loop on the server, streams, modules and building APIs with Express.

  1. What is the difference between path.join and path.resolve?

    join just glues segments together with the correct separator. resolve builds an absolute path, processing segments right to left until it has one, and falls back to the current working directory.

    BeginnerQuick answer1 min read
  2. Why use path.join instead of joining file paths with plus signs?

    path.join uses the correct separator for the operating system, normalises extra slashes and dot segments, and avoids missing or doubled slashes, so paths work on Windows, Linux and macOS.

    BeginnerQuick answer1 min read