There have been quite a few changes between Navigator 2.0 and
Navigator 3.0. Some of these are differences in the core JavaScript
language--differences between JavaScript 1.0 and JavaScript 1.1.
Others are the addition of new objects, the implementation of
LiveConnect, and changed functionality in existing objects. The
changes are listed below. Details can be found on the various
reference entries, and in the main chapters of the book.
There have been quite a few additions and improvements to the core
JavaScript language, and to the way that it is embedded in HTML
files:
- The typeof and void
operators have been added. See Chapter 4, Expressions and Operators.
- The constructor property of all objects
completements the typeof operator as a
way to determine the type of objects. (The
type property the Element object serves a
similar purpose for HTML form elements). See Chapter 7, Objects and the "Object.constructor" reference entry.
- Constructor functions may now have a prototype object that
defines methods, constants, and default properties shared by
all objects created by the constructor. See Chapter 7, Objects, and the "Object.constructor" reference entry.
- The String object is now a true JavaScript object, with a
constructor, and a new split() method.
- The Boolean and Number objects have been added. The Number
object defines several useful constants.
- The Function object now supports a constructor for the
creation of "anonymous" functions. See
Chapter 6, Functions.
- The Array object provides a useful constructor for the
creation of arrays, and also new sort(),
reverse(), and join()
methods. Array handling in JavaScript 1.1 is much improved
over JavaScript 1.0. See Chapter 8, Arrays.
- The Math.random() method works on all
platforms in JavaScript 1.1, and the Not-a-Number value,
NaN, and the isNaN()
function are implemented on all palatforms. This means that
parseInt() and
parseFloat() can now correctly return
NaN to signal invalid input.
- The eval() function of JavaScript 1.0 has
become a method of all objects in JavaScript 1.1. This
allows JavaScript code to be evaluated in the context of any
desired object. When used as a function in JavaScript 1.1,
eval() will evaluate the code in the
context of the current window, just as it did in JavaScript
1.0.
- All objects can now be given an assign()
method, which essentially overloads the assignment operator
for that particular object.
See Chapter 7, Objects.
- Files of pure JavaScript code, given the
.js file extension, may now be included
within HTML files with the SRC attribute
of the <SCRIPT> tag.
See Chapter 10, Client-Side Program Structure.
- You can specify code that requires JavaScript 1.1 and should
not be run on JavaScript 1.0 platforms with the
LANGUAGE="JavaScript1.1" attribute of the
<SCRIPT> tag.
See Chapter 10, Client-Side Program Structure.
- JavaScript code can also be embedded within HTML tags
between &{ and };
using the new JavaScript entity.
See Chapter 10, Client-Side Program Structure.