Javascript, a couple more questions

This rounds out a bit that I did not find clear answers for today.

  • There seems to be different versions of Javascript, but I have not seen any books or websites say, "This is aimed at ECMAScript version 2." There seems to be ECMAScript 5, which if it is assumed that the wiki page is not used in any browsers. So what do I need to know about versions?

  • From the side of the Javascript server. I saw a few mentions of this, and I did not discuss it specifically, but in one or two sentences where server-side Javascript is used and why?

  • I assume that different browsers support different subsets (guessing) of Javascript, but again, I did not read this, it just seemed logical given the state of all other web technologies. Is this right or am I leaving?

+7
source share
2 answers

1: ECMAScript 3 is what all current browsers support. ES5 is the new standard that is currently being adopted.

But that does not stop you from using most of the features of ES5 in modern browsers. It turns out that you can emulate most of them by adding functions to prototypes (for example, the string.trim function is quite simple to implement)

Update: as Reid noted in the comments, there is a good table describing ES5 compatibility in different browsers here

2: Node.js is apparently the most popular server-side javascript engine at the moment, but there are many of them.

There are several other servers that also run javascript on the server. MongoDB , for example, uses JSon to pass results back and forth, and the display / reduction functions must be written in JavaScript, which is then run on the server.

3: No, they all support the ES3 standard. They differ only in the API (the same language).

This means that although Google Chrome supports local storage, they do provide access to this function through JavaScript objects inside the DOM . In IE8, these objects simply do not exist and cannot be called.

Also: EcmaScript always refers to JavaScript, they simply cannot name standard JavaScript, because JavaScript is a trademark of Sun (a company that owns Java).

+5
source

Everyone only mentions ES5 because ES4 was dropped and ES1,2 and 3 within 3 years of each other. ES3 was released in 1999, so until ES5 is completed / supported, it is the only version that exists for all purposes and tasks.

0
source

All Articles