Latest web development tutorials
 

JavaScript Boolean constructor Property

< JavaScript Boolean Reference

Example

The constructor property returns a booleans's constructor function:

var bool = false;

The constructor property returns:

function Boolean() { [native code] }
Try it Yourself »

Definition and Usage

In JavaScript, the constructor property returns the constructor function for an object.

The return value is a reference to the function, not the name of the function:

For JavaScript numbers the constructor property returns function Number() { [native code] }

For JavaScript strings the constructor property returns function String() { [native code] }

For JavaScript booleans the constructor property returns function Boolean() { [native code] }


Browser Support

Property
constructor Yes Yes Yes Yes Yes

Syntax

boolean.constructor

Technical Details

Return Value: function Boolean() { [native code] }
JavaScript Version: 1.1

< JavaScript Boolean Reference