Ian
Ian

Reputation: 4909

Javascript, a couple more questions

This is a bit of a round up of the things I haven't found clear answers to today.

  1. There appear to be different versions of Javascript, but I've not seen any books or web sites say "This targets ECMAScript version 2". There seems to be an ECMAScript 5 which if the wiki page is to be believed isn't used in any browsers. So do I need to know about versions?

  2. Server side Javascript. I've seen a few mentions of this, and I haven't been looking at it specifically, but in a sentence or two, where is server side Javascript used and why?

  3. I assume different browsers support different subsets (guessing) of Javascript, but then again, I haven't read that, it just seemed logical given the state of all the other web technologies. Is that right or am I way off?

Upvotes: 5

Views: 204

Answers (2)

Tigraine
Tigraine

Reputation: 23648

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

But this does not keep you from using most of ES5 features in todays browers. Turns out you can emulate most of them by adding functions to prototypes (like the string.trim function is rather easy to implement)

Update: As Reid pointed out in the comments there is a nice table outlining ES5 compatibility in different browsers available here

2: Node.js seems to be the most popular server-side high-scale javascript engine at the moment, but there are a lot of them.

There are a couple other servers that also run javascript on the server. MongoDB for example uses JSon to transfer results back and forth, and map/reduce functions have to be written in JavaScript that then gets run on the server.

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

This means that while Google Chrome supports local storage, they provide access to that functionality through JavaScript objects inside the DOM. In IE8 these objects simply don't exist and can't be called.

Also: EcmaScript always refers to JavaScript, they just couldn't name the standard JavaScript since JavaScript is a trademark of Sun (the company that owns Java).

Upvotes: 4

Rich Bradshaw
Rich Bradshaw

Reputation: 72975

Everyone only mentions ES5 because ES4 was dropped, and ES1,2 and 3 all came out within 3 years of each other. ES3 came out in 1999, so until ES5 is finalised/supported it's the only version that exists for all intents and purposes.

Upvotes: 0

Related Questions