Html dom tutorial 46-JavaScript Boolean object
A Boolean object is a basic data type of JavaScript.
A Boolean object is a Boolean object that packages a Boolean value.
1: Boolean object Method
Method |
Description |
FF |
N |
IE |
ToSource () |
Source code of the object |
1 |
4 |
- |
ToString () |
Converts a logical value to a string and returns the result. |
1 |
4 |
4 |
ValueOf () |
Returns the original value of a Boolean object. |
1 |
4 |
4 |
2: attribute of a Boolean object
Attribute |
Description |
FF |
N |
IE |
Constructor |
A reference to the function that creates this object |
1 |
2 |
4 |
Prototype |
Allows you to add attributes and methods to an object |
1 |
2 |
4 |
3: valueOf () method
In this example, we will create a Boolean object and use valueOf () to obtain the original value of this object:
<script type="text/javascript">
var boo = new Boolean(false)
document.write(boo.valueOf())
</script>
Output:
false