Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Node.js vs Browser JavaScript | Understanding Node.js and Its Core Concepts
Node.js Foundations

bookNode.js vs Browser JavaScript

When you write JavaScript, the environment where your code runs significantly affects what you can do and how your code interacts with the outside world. The two most common environments for JavaScript are Node.js and web browsers. Understanding the differences between these environments will help you choose the right tools and approaches for your projects.

Node.js vs Browser JavaScript Key Differences

Environment

  • Node.js runs JavaScript on the server, outside of any browser;
  • Browsers run JavaScript on the client side, directly inside the user's web page.

APIs and Built-in Modules

  • Node.js includes APIs for working with the file system, networking, and running processes;
  • Browsers provide APIs for manipulating the web page (DOM), handling user events, and interacting with the web.

Typical Applications

  • Node.js is used to build server-side applications, command-line tools, and scripts;
  • Browser JavaScript is used to create interactive web pages and user interfaces.

Security and Permissions

  • Node.js scripts can access the local file system and network by default;
  • Browser JavaScript is sandboxed for security, limiting access to the user's device.

Global Objects

  • Node.js provides global objects like global, process, and Buffer;
  • Browsers provide objects like window, document, and navigator.

These differences mean that code written for Node.js often cannot run in the browser without changes, and vice versa.

Note
Study more

Some APIs are unique to Node.js, such as the fs module for file system operations, http for creating servers, and process for interacting with the running process. In contrast, browsers offer APIs like the Document Object Model (DOM) for manipulating HTML, window for managing browser windows, and fetch for network requests. Exploring the documentation for Node.js and browser APIs will help you understand which features are available in each environment.

question mark

Which statement best describes a key difference between Node.js and browser JavaScript?

Select the correct answer

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 2

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Awesome!

Completion rate improved to 9.09

bookNode.js vs Browser JavaScript

Glissez pour afficher le menu

When you write JavaScript, the environment where your code runs significantly affects what you can do and how your code interacts with the outside world. The two most common environments for JavaScript are Node.js and web browsers. Understanding the differences between these environments will help you choose the right tools and approaches for your projects.

Node.js vs Browser JavaScript Key Differences

Environment

  • Node.js runs JavaScript on the server, outside of any browser;
  • Browsers run JavaScript on the client side, directly inside the user's web page.

APIs and Built-in Modules

  • Node.js includes APIs for working with the file system, networking, and running processes;
  • Browsers provide APIs for manipulating the web page (DOM), handling user events, and interacting with the web.

Typical Applications

  • Node.js is used to build server-side applications, command-line tools, and scripts;
  • Browser JavaScript is used to create interactive web pages and user interfaces.

Security and Permissions

  • Node.js scripts can access the local file system and network by default;
  • Browser JavaScript is sandboxed for security, limiting access to the user's device.

Global Objects

  • Node.js provides global objects like global, process, and Buffer;
  • Browsers provide objects like window, document, and navigator.

These differences mean that code written for Node.js often cannot run in the browser without changes, and vice versa.

Note
Study more

Some APIs are unique to Node.js, such as the fs module for file system operations, http for creating servers, and process for interacting with the running process. In contrast, browsers offer APIs like the Document Object Model (DOM) for manipulating HTML, window for managing browser windows, and fetch for network requests. Exploring the documentation for Node.js and browser APIs will help you understand which features are available in each environment.

question mark

Which statement best describes a key difference between Node.js and browser JavaScript?

Select the correct answer

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 2
some-alt