[Appendix D] D.9 Miscellaneous Differences
Author: David Flanagan
Date: Fri Aug 29 10:43:55 1997

#

| Appendix D JavaScript Incompatibilities in Internet Explorer 3.0 |

## D.9 Miscellaneous Differences

Other differences between Navigator and Internet Explorer 3.0 are small details about the way values are computed and printed:

- The `for/in` statement in IE 3.0 does not always enumerate the same object properties that Navigator does. It does enumerate all user-defined properties, which is its primary function. But predefined properties of built-in objects are not always listed.

- The && and || operators behave somewhat differently in Navigator and Internet Explorer, although, since JavaScript is an untyped langauge, the difference is usually irrelevant. When the first operand of the `&&` operator evaluates to `true`, then the operator returns the value of the second operand in Navigator. In Internet Explorer, this second operand is first converted to a Boolean value, and that value is returned. Thus the expression

      true && 10

  evaluates to `10` in Navigator but to `true` in Internet Explorer. This may seem like a major difference, but because JavaScript is an untyped langauge, it rarely matters. The `&&` operator is almost always used in a Boolean context, such as the expression of an `if` statement, so even when Navigator returns a value like `10`, that value will be immediately converted to the Boolean value `true` within that context. The same evaluation difference occurs when the first operand of the `||` operator evaluates to `false`.

- In Internet Explorer 3.0, Boolean values implicitly are converted to strings differently than they are in Navigator. The value `true` is converted to the string `-1`, and the value `false` is converted to the string `0`. If you actually want them to be converted to the strings "true" and "false", you must convert them explicitly by adding them to the empty string.

- User-defined function values are also converted to strings differently in IE 3.0. In Navigator, functions are converted to a string that includes the complete body of the function. In fact, you can even use `eval()` function to define the function in some other window. This does not work in Internet Explorer, which omits the function body from its string representation of functions.

Supported but Nonfunctional Properties |  | A Preview of Navigator 4.0