Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Node.js a JavaScript runtime environment or an EcmaScript environment?

According to https://nodejs.org/en/

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

However, according to this answer, JavaScript is:

JavaScript = ECMAScript + DOM API;

and there is no DOM in Node.js runtime. (or is there?) Also quoting from the book: Professional JavaScript for Web Developers:

Though JavaScript and ECMAScript are often used synonymously, JavaScript is much more than just what is defined in ECMA-262. Indeed, a complete JavaScript implementation is made up of the following three distinct parts:

  • The Core (ECMAScript)
  • The Document Object Model (DOM)
  • The Browser Object Model (BOM)

which supports the answer I link to.

Considering the facts above, isn 't it correct to say Node.js is a ECMAScript runtime? If not, what do we need to remove (or add?) if we wanted to fork Node.js and make it an ECMAScript runtime instead of a JavaScript runtime?

like image 632
Koray Tugay Avatar asked May 11 '18 16:05

Koray Tugay


People also ask

What is Node JS?

Node.js is a JavaScript runtime… | by Priyesh Patel | We’ve moved to freeCodeCamp.org/news | Medium What exactly is Node.js? Node.js is a JavaScript runtime environment. Sounds great, but what does that mean? How does that work? The Node run-time environment includes everything you need to execute a program written in JavaScript.

What is a runtime environment in Node JS?

I get that Node js uses V8 as its Javascript engine which can read Js Code, interpret it and run it, and that the runtime environment provides extra functionalities to your Javascript. but if someone asks me what a runtime environment is, should I say it is a programwhich has two main jobs:

What are the different types of JavaScript runtime environments?

1. NodeJS : NodeJS is a cross-platform and opensource Javascript runtime environment that allows the javascript to be run on the server-side. Nodejs allows Javascript code to run outside the browser.

What is the difference between ECMA and nodeJS?

It is the upgraded version of ECMA script that uses Chrome’s V8 engine written in C++. Nodejs is written in C, C++ and Javascript.


1 Answers

The difference between JavaScript and ECMAScript is just a pedantic difference that most people don't really care about. Technically the official language name according to the standard is ECMAScript, but for historical and convenience reasons people almost always call it "JavaScript". I've never met anybody who calls themselves an "ECMAScript developer".

As far as I know, JavaScript doesn't even have an official formal definition. While ECMAScript has a prescriptive definition with versions that are formally defined by their various specifications, the meaning of "JavaScript" is essentially defined by how people use it.

For this reason, Node.js advertises itself as a JavaScript runtime. It might be more "technically correct" to call it an ECMAScript runtime, but it would be more confusing for most people to advertise it that way.

like image 110
Peter Olson Avatar answered Oct 16 '22 15:10

Peter Olson