New in JavaScript 1.5

JavaScript version 1.5 provides new features and enhancements described below.

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. See the Number Object page.

Regular expression enhancements

The following regular expression enhancements have been added:

  • Quantifiers — +, *, ? and {} — can now be followed by a ? to force them to be non-greedy. See the entry for ? on the Writing a Regular Expression Pattern page.
  • 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. See the entry for (?:x) on the Writing a Regular Expression Pattern page.
  • Positive and negative lookahead assertions are supported. Both assert a match depending on what follows the string being matched. See the entries for x(?=y) and x(?!y) on the Writing a Regular Expression Pattern page.
  • The m flag has been added to specify that the regular expression should match over multiple lines. See the Advanced Searching With Flags page.

Conditional function declarations

Functions can now be declared inside an if clause. See the Defining Functions page.

Function expressions

Functions can now be declared inside an expression. See the Defining Functions page.

Multiple catch clauses

Multiple catch clauses in a try...catch statement are supported. See The catch Block page.

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. See the Defining Getters and Setters page.

Constants

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

Document Tags and Contributors

Contributors to this page: Sheppy, Yuichirou, Simon, ethertank, cronopio, Potappo, user01, XP1, Bedi
Last updated by: Sheppy,