Z
Z
Zmaster2011-04-09 14:41:46
JavaScript
Zmaster, 2011-04-09 14:41:46

What is the difference between Javascript and ECMAscript?

Hello Habr.
I am a student of the IT faculty, in rare free moments I am engaged in self-education and the study of various things. Now life has forced me to start learning Javascript. When you start to study any technology, it is important to know at least minimally what it originated from and why it was invented. I have the following difficulty.
How is Javascript different from ECMAscript? Who is based on whom? I wanted to find the Javascript spec, but I only found one for ECMA-262. After the words that “Javascript is an implementation of ECMAscript”, I have a logical thought that this implementation should be regulated by something?
Who is developing both technologies? Who standardizes? And further. Why "Java" in Javascript?
Dear Habr, I'm sorry if the question seems stupid. I honestly googled. Hoping for an answer and all that.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
B
b0n3Z, 2011-04-09
@Zmaster

Javascript is Mozilla 's implementation of the ECMAscript standard. We can say that this is a superset of ECMAscript, because it has such things as list expressions, short lambda functions, generators (yield), generator expressions, let is a keyword for creating more advanced local variables (for example, only within a loop for), destroying assignments ([a, b] = [b, a]).
Of the popular browsers, only Firefox fully supports Javascript, so you should not use all these cool features. However, as a rule, everything that appears in Mozilla soon appears in the official standard, that is, in ECMAscript - this was the case with JS1.6, from where the list methods map, filter, forEach, indexOf passed into the standard.
A JScript— implementation of the ECMAscript standard by Microsoft.

X
xanep, 2011-05-03
@xanep

What came first, the chicken or the egg? :)
To understand how Javascript and ECMAscript relate, you need to plunge into history a little. Javascript was created as a scripting language for Netscape. Microsoft created their own scripting language for IE called JScript. Naturally, using 2 languages ​​for different browsers was not kosher, and Netscape initiated standardization, resulting in the birth of the ECMAscript language standard. ECMAscript is not tied to browsers, it does not have input / output facilities by itself. Subsequent versions of the Javascript and JScript languages ​​have been brought into line with the ECMAscript standard. ActionScript was also created based on this standard.
As a result, today Javascript consists of 3 practically separate parts
- Core (fully compliant with the ECMAscript standard),
- Document Object model (DOM)
- Browser Object Model (BOM)
DOM is an API for accessing HTML. You can find its specification on the W3C website. BOM in each browser is implemented differently. Accordingly, you will find Mozilla's (as Netscape's successor) Javascript specification on their website. Separately, you can read the ECMAscript and DOM specifications.
As a result, it turns out that initially the ECMAscript standard was based on Javascript, and then Javascript is based on ECMAscript. It's so confusing :)
Well, the prefix Java is a marketing ploy. Java was very popular in the 90s, which is why they chose this name. More precisely, they even renamed the language from LiveScript to Javascript.

A
Alexey Sidorov, 2011-04-09
@Gortauer87

Well, what's the difference between a class and an instance of a class?

M
Melanitsky, 2011-04-09
@Melanitsky

Javascript is a dialect of ECMAscript. ECMA is a JavaScript standard. They deal with the W3C.
And the java refix itself is just a PR move.

W
w_serj, 2013-12-05
@w_serj

If core javascript is fully ECMAscript compliant, then explain why
true === ('0' == false).
Although ECMA-262 5.1 June 2011 clause 11.9.3 subclause d says -

d. If Type(x) is String, then return true if x and y are exactly the same sequence of characters (same
length and same characters in corresponding positions). Otherwise, return false.

I know that Mozilla says something completely different.
Equal (==)
If the two operands are not of the same type, JavaScript converts the operands then applies strict comparison. If either operand is a number or a boolean, the operands are converted to numbers if possible; else if either operand is a string, the other operand is converted to a string if possible. If both operands are objects, then JavaScript compares internal references which are equal when operands refer to the same object in memory.
(From Comparison Operators in Mozilla Developer Network)

But who is right in this case? And how many more similar nuances (if possible with examples)?
Chrome and firefox follow mozilla guidelines.
---
Question removed. I will read more carefully.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question