JavaScript on the server in nodejs

basic · Node.js — Server-side JavaScript

1. The Core Engines Browser: Every browser has its own engine. Chrome and Edge use V8 , Safari uses JavaScriptCore , and Firefox uses SpiderMonkey . These engines focus on rendering UI and handling user interactions. Node.js: Node.js is a runtime built specifically on Chrome's V8 engine . It takes the engine out of the browser and puts it on your machine (server) to execute JavaScript code directly. 2. Global Objects The environment determines what global variables are available to you. Browser: The global object is window . You have access to things like document (the DOM), alert() , and history . Node.js: The global object is global . Since there is no browser window, window and document are undefined . Instead, you have access to process , __dirname , and module .  Feature  Browser  Node.js  DOM Access  Yes (Can manipulate HTML/CSS)  No (No UI to manipulate)  File System  No (Security restriction)  Yes (Can read/write files via fs )  OS Access  No  Yes (Access to CPU, Network, Memory)  Network  Fetches data from APIs  Can be the API (starts servers)

Back to Node.js — Server-side JavaScript

Browse all study material on Careeroza