I thought this release was supposed to have ActionScript style optional type annotations and classical inheritance. Not to say I'm sad to not see them here (JS being dynamic and prototypal seems nicer to me), but anyone know what happened to those?
The latest official ECMAScript standard is ECMAScript 3rd edition from 1999. Since then there have been several attempts to create an upgrade, known as ECMAScript 4. For example ActionScript 3 and Microsofts JScript.Net is actually based on an abandoned ECMAScript 4 proposal from around 2000-2003, a spec that way heavily influenced by Java. A new ECMAScript 4 effort started a few years ago with Brendan Eich as editor, which was more inspired by dynamic and functional languages.
However the new ECMAScript 4 spec was pretty large and ambitious, and some parts of the working groups called for a lesser, incremental spec release to fix some of the most needed fixes. This proposal was called ECMASCript 3.1. Then it was decided to scale the ambitious ECMAScript 4 spec back, and this scaled back version (which is still in flux) is called ECMAScript Harmony.
Now ECMAScript 3.1 has been released, but they have decided to give it the official name ECMAScript 5th edition, thereby leapfrogging the 4th edition! This might be because "ECMAScript 4" have gotten a bad name because of the several failed attempts. Also, it is obviously confusing when widely different specs gets the same name.
Harmony will then probably be 6th edition, and if some of the features from ES4 which was culled from Harmony appears in a later spec, it might be in 7th edition!
While ES5 doesn't have ES4/ActionScript classes, some of the features it introduces (like Object.freeze) are explicitly design to support classical inheritance, and the ES "Harmony" project will probably build more classical OOP syntax into the next version, on top of the new ES4 semantics.
A quick look. I may have got a few details wrong, since the standard is rather terse:
JSON support (adds Internaltype.prototype.toJSON, JSON.parse and JSON.stringify).
Object.create now exists, allowing you to create an object from another object's prototypes and, optionally, a set of properties (i.e. equivalent to var constructor = { }; var blah = new constructor(); blah.prototype = originalobject.prototype;). JavaScript has been crying out for this for years.
There's also ways of preventing modifications to objects (Object.preventExtensions, Object.seal, Object.freeze) and ways to check them (Object.isFrozen, Object.isExtensible and Object.isFrozen).
Data objects have new properties: writable (i.e. whether something is read only), enumerable (i.e. whether it appears in a for-in loop) and configurable (i.e. whether deletable).
It now exposes most internal properties of objects via defineProperty/defineProperties, getOwnPropertyNames, getOwnPropertyDescriptor and hasOwnProperty. I think this is what it does anyway: it seems a little subtle when combined with the interaction of prototypes. One subtlety is that it provides syntax for interaction with the properties of HTML elements.
I believe it has warm Microsoft support and IE8 already implements large parts of this standard, so it's going to be usable sometime in the future.
I messed up my code example for Object.create above rather badly (I haven't done JS in a while), so I'll redo it here:
var constructor = function() { };
originalobject = new constructor();
originalobject.prototype = ...;
blah = new constructor();
blah = foo.prototype
In ES5 this can be replaced with:
var constructor = function() { };
originalobject = new constructor();
originalobject.prototype = ...;
boom = Object.create(originalobject);
It's worth adding that the ES5 standard implements getters and setters, although I don't believe anything implements it yet (IE8 implements a subset but only for the global and HTML objects apparently):
var foo = {};
Object.defineProperty(foo, "bar", { set: function(arg) { alert(arg) } }); //replace the built-in "set"
foo.bar = "test"; //alert appears printing "test".
Object.defineProperty(foo, "bar", { set: undefined }); //undo our overloading
foo.bar = "test"; //sets foo.bar to test, as normal
Also: A bunch of higher order functions for arrays: map, reduce, forEach, every, some.
Some small syntactical improvements, like the ability to use a trailing comma in list literals [1,2,3,]
Getters and setters.
A new "strict mode", which disallows some of the more error-prone features. For example, in strict mode, assigning to a non-existing variable throws an error rather than creating a new global variable.
> enumerable (i.e. whether it appears in a for-in loop
Huh? I can see "can appear in a for-in loop", but "appears" is different and I'm not sure why I care or what it even means means. (Appears when is one question.)
offtopic - you might be interested in dmitris Raphael Javascript lib to manipulate 2D graphics [uses SVG if its supported, or VML on M$ browsers] - http://raphaeljs.com