JavaScript | Boolean constructor Property
In JavaScript, the constructor property returns the constructor function for an object. For JavaScript Boolean, the constructor property returns function Boolean() { [native code] }.
Syntax:
boolean.constructor
Return value: It returns the function Boolean() { [native code] }.
Example 1: This example illustrates boolean constructor property.
<!DOCTYPE html> <html> <head> <title> JavaScript Boolean constructor Property </title> </head> <body style="text-align:center;"> <div style="background-color: green;"> <h1>Welcome to GeeksforGeeks!.</h1> <p> It returns the function that created the boolean's prototype: </p> <h1 id="GFG"></h1> </div> <!-- Script to use boolean constructor --> <script> var bool = false; document.getElementById("GFG").innerHTML = bool.constructor; </script> </body> </html> |
Output :

Example 2: This example illustrates boolean constructor property.
<!DOCTYPE html> <html> <head> <title> JavaScript Boolean constructor Property </title> </head> <body style="text-align:center;"> <div style="background-color: white;"> <h1>Welcome to GeeksforGeeks!.</h1> <h3> It returns the function that created the boolean's prototype: </h3> <p id="name" style="background-color: green;"></p> </div> <!-- Script to use Boolean constructor Property --> <script> var bool = false; document.getElementById("name").innerHTML = bool.constructor; </script> </body> </html> |
Output:

Recommended Posts:
- JavaScript | Number constructor Property
- JavaScript | Date constructor Property
- JavaScript | Array constructor Property
- JavaScript | String constructor Property
- JavaScript | Boolean
- How to toggle a boolean using JavaScript ?
- JavaScript | RegExp constructor
- JavaScript | Array prototype Constructor
- How to generate a random boolean using JavaScript ?
- JavaScript | Boolean.prototype with Examples
- JavaScript | boolean.valueOf() function
- JavaScript | boolean.toString() function
- JavaScript | Convert a string to boolean
- JavaScript | Boolean and dataView Complete Reference
- Convert boolean result into number/integer in JavaScript
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




