|
The ECMAScript Language Specification is a programming language specification published by the ECMA International. Development of the standard began in 1996 and was based on the popular scripting language JavaScript. It has now been accepted as ISO standard 16262.
ECMAScript defines a dynamically-typed language based mostly on Self, with a C-like syntax and some naming-conventions derived from Java. It supports object-oriented features through prototype based objects and pseudo-classes. And as functions are first-class objects, it fully includes higher-order functions.
Example:
Array.prototype.fold =
function (value, functor) {
var result = value;
for (var i = 0; i < this.length; i++) {
result = functor(result, this[i]);
}
return result;
}
var sum = [1,2,3,4,5,6,7,8,9,10].fold(0, function (a, b) { return a + b })
Most modern Web browsers include an implementation of the ECMAScript standard as well as a DOM binding for manipulating Web pages. JavaScript is implemented in Netscape Navigator, and Microsoft's Internet Explorer uses JScript. The Opera browser has its own ECMAScript interpreter with extensions to support some JavaScript and JScript features. Each browser has custom extensions to the ECMAScript standard, but any ECMAScript compliant code should work in any of the three.
ActionScript for Macromedia Flash is also based on the ECMAScript standard, with enhancements to allow objects to be dynamically moved, created, and parsed while running the movie.
JavaScript 2.0, JScript .NET and ActionScript 2.0 are each based on the unfinished ECMAScript 4 recommendation.
See also
External links
|