ExtendScript: Unexpected evaluation of "null" as second operand in logical ops
I've just come across an unexpected problem in the way that "null" appears to be evaluated when it's the second operand of AND or OR. All the expressions below should return "null" (but are returning the comments instead).
alert( true && null ); // true
alert( 1 && null ); // undefined
alert( "1" && null ); // undefined
alert( false || null ); // false
alert( 0 || null ); // undefined
alert( "" || null ); // undefined
// $.writeln( true && null ); // true
// $.writeln( 1 && null ); // undefined
// $.writeln( "1" && null ); // undefined
// $.writeln( false || null ); // false
// $.writeln( 0 || null ); // undefined
// $.writeln( "" || null ); // undefined
As far as I can tell, this is not the expected behaviour even in ES3. "null" appears to be evaluated as expected when it's the first operand. A quick Google search did not yield much.
Is there any way this can be explained?
Thanks in advance.
