David said:
Such as?
but that's beside the (main) point.
Which would be?
Don't need to. There's nothing wrong with using == in this case.
Indeed; I stand corrected:
| 11.9.1 The Equals Operator ( == )
|
| The production
| EqualityExpression : EqualityExpression == RelationalExpression
| is evaluated as follows:
|
| 1. Evaluate EqualityExpression.
| 2. Call GetValue(Result(1)).
| 3. Evaluate RelationalExpression.
| 4. Call GetValue(Result(3)).
| 5. Perform the comparison Result(4) == Result(2). (Section 11.9.3.)
| 6. Return Result(5).
|
| [...]
| 11.9.3 The Abstract Equality Comparison Algorithm
|
| The comparison x == y, where x and y are values, produces true or false.
| Such a comparison is performed as follows:
|
| 1. If Type(x) is different from Type(y), go to step 14.
| 2. If Type(x) is Undefined, return true.
| 3. If Type(x) is Null, return true.
| 4. If Type(x) is not Number, go to step 11.
| 5. If x is NaN, return false.
| 6. If y is NaN, return false.
| 7. If x is the same number value as y, return true.
| [...]
as compared to
| 11.9.4 The Strict Equals Operator ( === )
|
| The production
| EqualityExpression : EqualityExpression === RelationalExpression
| is evaluated as follows:
|
| 1. Evaluate EqualityExpression.
| 2. Call GetValue(Result(1)).
| 3. Evaluate RelationalExpression.
| 4. Call GetValue(Result(3)).
| 5. Perform the comparison Result(4) === Result(2). (See below.)
| 6. Return Result(5).
|
| [...]
| 11.9.6 The Strict Equality Comparison Algorithm
|
| The comparison x === y, where x and y are values, produces true or false.
| Such a comparison is performed as follows:
|
| 1. If Type(x) is different from Type(y), return false.
| 2. If Type(x) is Undefined, return true.
| 3. If Type(x) is Null, return true.
| 4. If Type(x) is not Number, go to step 11.
| 5. If x is NaN, return false.
| 6. If y is NaN, return false.
| 7. If x is the same number value as y, return true.
| [...]
Nope. First thing I would think on seeing === is that the two
operands could be different types. Using == makes the author's
intentions clear.
Then we have to agree to disagree here.
I wonder what usable browser would lack a document object. No
evidence to support that AFAIK.
Well, evidence has been provided to suggest that it is at least possible.