runtime

console.log(process.platform);
console.log(process.version);

Output shape:

linux
v...

No DOM

window , document , and localStorage are not here That absence is the first thing a browser developer notices

What replaces them:

  • globalThis for the global object
  • process for the running program
  • core modules for files, network, and buffers

path

import { join, dirname } from "node:path";

join("a", "b");
dirname("/tmp/a.txt");

Output:

a/b
/tmp

Use node:path rather than string concatenation Windows separators are the reason

process

process.env holds environment variables process.exit() ends the program process.argv holds command line arguments

Calling exit() in the middle of a pending write truncates work Finish or abort cleanly instead

Next

How code is loaded in 02 modules

Posted