What is process in Node.js?

Why Interviewers Ask This

Foundational questions like this help interviewers calibrate the rest of the interview. A confident, accurate answer signals that you have solid Node.js basics — a prerequisite for any developer role.

Answer

process is a global object in Node.js that provides information about, and control over, the current Node.js process. Key properties and methods: process.env — environment variables (e.g., process.env.NODE_ENV, process.env.PORT); process.argv — command-line arguments array (index 0: node path, index 1: script path, index 2+: user args); process.cwd() — current working directory; process.exit(code) — exit the process (0 = success, non-zero = error); process.pid — process ID; process.version — Node.js version string; process.platform — OS platform; process.memoryUsage() — memory usage stats; process.stdin, process.stdout, process.stderr — standard streams; process.on("uncaughtException", handler) — catch unhandled errors (use with care); process.on("SIGTERM", handler) — handle OS signals for graceful shutdown.

Pro Tip

If you're unsure about a detail, say so honestly and explain your reasoning. Interviewers respect candidates who can think through uncertainty rather than bluffing.