What does it mean to say that nodeJS is built on a V8 engine?

I'm starting to work with the MEAN stack, learning NodeJS, I came up with the following statement, in which I mentally

Node.js is a very powerful JavaScript platform. in Google Chrome JavaScript V8 Engine.

but what exactly does this mean

Built on Google Chrome JavaScript V8 Engine.

and if it is built on Chrome JS V8 Engine, why does it work with Firefox too?

+5
source share
7 answers

Reorganized MEAN NETWORK:

  • MongoDB: save data, save data for later retrieval
  • Node.js: web application server responding to client requests
  • Express: web application infrastructure, shortens Node template
  • Angular.js: browser framework

So, Node.js does not work in Firefox (it also does not work in Google Chrome): it is a server technology. Think of it as replacing Python / Ruby / Java in this role. Thus, it can respond to requests from all clients (for example, Google Chrome and Firefox).

What β€œbuilt on V8” means is that it uses the exact same on-time JavaScript interpreter / compiler as Google Chrome. But the similarity to chrome largely rests on what has been achieved: Node does not have a / css parser / DOM rendering handler, but you have things you need on the server, for example, in the HTTP library and the file system API.

In addition, and I do not mean insult: we all started where you are, the fact that you even ask a question (which is again not so bad!) Means that building on a stack, like MEAN, is above your head. The documentation will assume that you know what you don't seem to know. I highly recommend promoting your understanding of JavaScript and Node through some tutorials and applications for testing barebone applications before trying to throw databases and frameworks in the mix.

+10
source

In order for a programming language to be executed by a computer, it must be translated into a format that a machine can understand (usually called machine code ). Javascript is no different. When your browser is presented with Javascript code on a website, something needs to be compiled or, in the case of Javascript, interpreted instructions in machine code.

V8 is a program developed by Google for this. When you use Chrome and detect Javascript on the page, it passes it to V8 to start compilation, and then your computer executes the resulting code.

V8 was opened by Google. Node creator, Ryan Dahl, modified the source code so that the V8 can be used outside of Chrome and inside an operating system such as Linux or MacOS. This is what is meant by your first quote.

It is important to note that you are not running your Node programs in a browser, but rather using the actual computer. There is no correlation between V8 and Firefox, Safari, IE, etc. All of these browsers have their own Javascript interpreters.

+2
source

Node uses the same JS engine that launches chrome. In this case, the engine is a piece of software that compiles or "translates" your JS code into machine code; or 0s and 1s that your computer can understand. This compilation is a complex process, and there are several different approaches to solving it, for example google v8 or mozilla spidermonkey. Each of them supports the entire JS standard (to a certain extent), that is, any JavaScript code can work on them.

When the node server starts, it starts on a computer that acts as a server. The code does not run at all on the user's machine; therefore, it doesn’t matter which browser is used to view your content.

On the MEAN stack, this is angular code that runs on a user machine. However, it is written in JavaScript, which can be run on any javascript engine.

+1
source

Ok, let's look at this:

Node.js is a very powerful / JavaScript-based platform built on the Google Chrome JavaScript V8 Engine.

JavaScript is a programming language used in Internet browsers. It was invented in 1995 by NetScape, I think, and was introduced to a certification organization called ECMA in 1996.

ECMA took the original JavaScript idea and made a standard called ECMAScript that every JavaScript implementation should implement. You see that JavaScript is not a language that exists somewhere on the air - every Internet browser comes with its own language implementation - this means that JavaScript usually only works in Internet browsers such as Mozilla, Safari, Opera or Chrome for example . (Internet Explorer also comes with an ECMAScript implementation, but they call it JScript for licensing reasons, which I consider)

The JavaScript implementation that comes with Google Chrome runs on the powerful V8 engine , which is written in a language called C ++ . V8 interprets your JavaScript code and provides it with all types of variables, manages memory, etc. The great thing about V8 is that it is open source and can be integrated into any other C ++ program.

So, the creators of Node had an idea to take V8 and improve it by adding features that the server should serve websites - reading files, responding to requests, routing, etc. This means that you can now program the server-side implementation of the website using JavaScript, thanks to the Node.js application, which interprets your code and essentially translates it into C ++ and later machine code down the line. An important difference is that Node.js does NOT start in your browser! It works on the server in the same way as when encoding back-end using PHP and apache.

+1
source

V8 Engine is a javascript interpreter used by Google Chrome.
The statement that NodeJS is built on top of this engine means that it uses this interpreter for its own thing, so it can also be used on the server, and not just in the desktop environment (for example, in Google Chrome).

NodeJS is a separate application with which you can communicate over the Internet, it is like Apache, Nginx or similar, but it is not used for only one thing (for example, those mentioned above), but it is mainly used to create a web server for the application.

0
source

Node.js is JavaScript on the server. For example, you can start the Node.js server at http: // localhost: 8000 / , and you can access it using Chrome or Firefox.

Using Node.js (which uses V8), the servers can be written in JavaScript, and not in PHP or Ruby.

0
source

In fact, NodeJS is a cross-platform platform. Perhaps you know that it is best suited for I / O and streaming applications, it uses the Google Chrome JavaScript V8 Engine for the above purposes, therefore it is browser and platform independent.

0
source

Source: https://habr.com/ru/post/1262090/


All Articles