This is an alternative way to retrieve a string version of a Boolean value. In this case, it is formatted as a Boolean literal and can then be used in an eval() function to assign another Boolean.
If you run the example below, it should yield this as a result:
(new Boolean(true))
However, you should note that this is not supported by MSIE browsers.
The result of calling this method is a string version of the Boolean formatted as a Boolean literal.
// Create a Boolean object and then examine its source myBoolean = new Boolean(true); document.write(myBoolean.toSource());
See also: | Boolean.prototype, Boolean.toString() |
Prev | Home | Next |
Boolean.prototype | Up | Boolean.toString() |
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. |