The first difference you’ll look at pertains to the global object.
The global object
In the browser,
window is the global object. Anything that you define in
window becomes available to all parts of your code. For example,
setTimeout is in reality
Node has two similar objects that provide a cleaner separation:
global: Just like
window, any property attached to
global becomes a variable you can access anywhere.
process: Everything that pertains to the global context of execution is in the
process object. In the browser, there’s only one window, and in Node, there’s only one process at any given time. As an example, in the browser, the window name is
window.name, and in Node, the name of the process is
Later chapters dig deeper into the
process object because it provides broad and interesting functionality, ...