When you run node main.mjs, Node loads V8, initializes libuv for async I/O, and executes your module graph. The process object exposes version info, environment variables, and exit codes.
Key process properties
process.version— Node semver (e.g. v20.x)process.env— environment variables (strings)process.cwd()— current working directoryprocess.argv— CLI arguments afternodeprocess.exit(code)— terminate (0 success, non-zero error)
LTS vs Current
Use LTS (Long Term Support) releases in production—they receive security fixes longer. Odd-numbered releases are "Current" and shorter-lived. Check nodejs.org for the active LTS line.
Important interview questions and answers
- Q: What is libuv?
A: The C library Node uses for the event loop, thread pool, and async file/network operations on multiple OSes. - Q: How do you read an env var safely?
A:process.env.PORT ?? '3000'with validation at startup—never assume vars exist in production.
Self-check
- What does exit code 0 mean?
- Where do CLI flags passed to your script appear?