JavaScript 2.0
Compatibility
|
Friday, March 14, 2003
JavaScript 2.0 is intended to be upwards compatible with almost all JavaScript 1.5 and earlier scripts. The following are the current compatibility issues:
[
expr,
expr]
should be replaced by expr[(
expr,
expr)]
.for
-in
variable; the =b
in the statement for (var a=b in c)
...
is not allowed.as
, is
, namespace
, and use
need to be renamed
or escaped with \_
because these are now reserved words.Boolean
, Number
, and String
. Boolean
,
Number
, and String
now refer to classes that have primitive booleans, numbers, and strings as
instances. The methods of these new classes correspond to the methods of JavaScript 1.5’s wrapper classes. The results
of calling new
on Boolean
, Number
, or String
are now implementation-defined,
so an implementation may choose to retain the wrappers for compatibility with JavaScript 1.5, but it is not required to
do so.Object
and String
may not work.For applications such as browsers where 100% compatibility is needed, scripts will be assumed to be written JavaScript
1.5 unless explicitly marked as being JavaScript 2.0 through either an HTML or XML attribute or by including a use ecmascript(4)
or use javascript(2)
statement.
Waldemar Horwat Last modified Friday, March 14, 2003 |