Visit Mozilla.org

Core JavaScript 1.5 Reference:About

From MDC


Contents

[edit] New Features in this Release

JavaScript version 1.5 provides the following new features and enhancements:

Runtime errors:

Runtime errors are now reported as exceptions.

Number formatting enhancements:

Number formatting has been enhanced to include Number.prototype.toExponential, Number.prototype.toFixed, and Number.prototype.toPrecision methods.

Regular expression enhancements:

  • Greedy quantifiers - +, *, ? and {} - can now be followed by a ? to force them to be non-greedy.
  • Non-capturing parentheses, (?:x) can be used instead of capturing parentheses(x). When non-capturing parentheses are used, matched subexpressions are not available as back-references.
  • Positive and negative lookahead assertions are supported. Both assert a match depending on what follows the string being matched.
  • The m flag has been added to specify that the regular expression should match over multiple lines.

Conditional function declarations:

Functions can now be declared inside an if clause.

Function expressions:

Functions can now be declared inside an expression.

Multiple catch clauses:

Multiple catch clauses in a try...catch statement are supported.

Constants:

Read-only, named constants are supported. This feature is available only in the C implementation of JavaScript.

Getters and Setters:

JavaScript writers can now add getters and setters to their objects. This feature is available only in the C implementation of JavaScript.

[edit] What You Should Already Know

Some programming experience with a language such as C or Visual Basic is useful, but not required.

The JavaScript language is intended to be used within some larger environment, be it a browser, a server-side scripts, or similar. For the most part, this reference attempts to be environment-agnostic and does not target a web browser environment. For demonstration purposes, this reference uses a function, print, which is not part of JavaScript or ECMAScript, and which can be mapped onto environment-specific functionality to display the single argument provided to it. For example, in a web browser print might have been defined as follows:

function print(string)
{
  window.alert(string);
}

Mapping onto equivalent functionality in other JavaScript environments is left as an exercise for the reader.

[edit] JavaScript Versions

Recent versions of Mozilla-based browsers support newer versions of JavaScript. The following table lists the JavaScript version supported by different Mozilla Firefox versions.

The browsers that support JavaScript version less than 1.5 are very rare today, since JavaScript 1.5 was introduced back in 1999. If you're interested in historic information, please refer to the Wikipedia article on ECMAScript.

[edit] JavaScript versions

JavaScript version (corresponds to the SpiderMonkey JavaScript engine version) Gecko version Firefox version
JavaScript 1.5 Gecko 0.6x-1.7 Navigator 6.0, Mozilla Application Suite, Firefox 1.0
JavaScript 1.6 Gecko 1.8 Firefox 1.5
JavaScript 1.7 Gecko 1.8.1 Firefox 2
JavaScript 1.8 Gecko 1.9 Firefox 3

[edit] Where to Find JavaScript Information

The core JavaScript documentation includes the following books:

If you are new to JavaScript, start with the Core JavaScript 1.5 Guide. Once you have a firm grasp of the fundamentals, you can use the Core JavaScript 1.5 Reference to get more details on individual objects and statements.