April 2002 Draft
JavaScript 2.0
Compatibility
|
Tuesday, October 9, 2001
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)]
.var s = "5"; var y = s++
will store "5"
in y
instead of 5
. The new value of s
is still 6
, just as in JavaScript
1.5.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 Tuesday, October 9, 2001 |