Boolean.toSource()
JavaScript1.3+, JScript3.0+, ECMAScript2.0+ (proposed) Nav4.06+, IE4+ Syntax
boolean.toSource()
Description
The toSource() method returns one string representing the source of the Boolean object. The string that is returned is enclosed in with parentheses.
Example
Listing 6.65 creates a Boolean object to represent true. The toSource() method is then applied to the Boolean object to return the source string "(new Boolean(true))".
Listing 6.65 Accessing the Source of a Boolean Object with the toSource() Method
<script language="JavaScript"> <!–– Hide //Create a Boolean object representing true bool = new Boolean(1); //Display the source of the Boolean object document.write(bool.toSource()); // End hide ––> </script> ... |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.