Boolean

Introduction

constructor

The constructor method returns the function that created the Boolean object's prototype. The following is the syntax for the constructor method.

obj.constructor;

Example

The following is the code for the constructor method.

var obj = new Boolean(true); document.write(obj.constructor);

On running the above code, the following output is obtained.

prototype

The prototype method allows properties and methods to be added to an object. The following is the syntax for the prototype method.

obj.prototype;

Example

The following is the code for the prototype method.

document.write(obj.prototype);

On running the above code, the following output is obtained.

toString()

The toString() method Converts a Boolean value to a string, and returns the result. The following is the syntax for the toString() method.

obj.toString();

Example

The following is the code for the toString() method.

document.write(obj.toString());

On running the above code, the following output is obtained.

valueOf()

The valueOf() method returns the primitive value of a Boolean object. The following is the syntax for the valueOf() method.

obj.valueOf();

Example

The following is the code for the valueOf() method.

document.write(obj.valueOf());

On running the above code, the following output is obtained.