Understand the difference between browser and Node.js runtime environments.
While the JavaScript engine executes the code, it does so within a larger 'runtime environment'. This environment provides additional features and APIs that JavaScript can interact with. The two most common runtimes are the browser and Node.js. The browser runtime is the environment we are most familiar with. It includes the JavaScript engine, but also provides Web APIs like the Document Object Model (DOM) for interacting with HTML, the `fetch` API for making network requests, and `localStorage` for storing data. These APIs are not part of the core JavaScript language itself but are provided by the browser to give JavaScript control over the web page. In contrast, the Node.js runtime allows JavaScript to be run outside the browser, on a server. It uses the V8 engine but provides a different set of APIs relevant to server-side tasks. For example, instead of the DOM, Node.js provides APIs for file system access (`fs` module), network operations (`http` module), and managing operating system processes. Understanding the distinction is key: the core JavaScript language is the same in both, but the available global objects and APIs differ based on the environment in which the code is being executed.