This is a Boolean primitive value representing the logically false state.
Conditional code execution depends on this value to signify the execution of a block of script code.
Beware of a rather insidious effect when converting Boolean primitive values into objects. All objects yield the value true when converted back to a Boolean primitive. This also applies to a Boolean object having the value false.
This if() test yields a true condition and selects the opposite branch to that which you would expect:
var myBoolean = new Boolean(false); if(myBoolean) { // This branch is called } else { // You would have expected this one to be called }
See also: | Boolean, Boolean, Boolean literal, Definition, true |
ECMA 262 edition 2 - section 9.2
ECMA 262 edition 2 - section 15.6
ECMA 262 edition 3 - section 9.2
ECMA 262 edition 3 - section 15.6
Prev | Home | Next |
Fade() | Up | fdlibm |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |