JAVASCRIPT BOOLEAN OBJECT

The Boolean object represents two values, either "true" or "false".

Syntax:

Use the following syntax to create a boolean object.
var val = new Boolean(value);

PROPERTIES:
1.constructor- Returns a reference to the Boolean function that created the object.
2.prototype- The prototype property allows you to add properties and methods to an object.

METHODS:

1.toSource()-Returns a string containing the source of the Boolean object; you can use this string to create an equivalent object.
2. toString()-Returns a string of either "true" or "false" depending upon the value of the object.
3. valueOf()-Returns the primitive value of the Boolean object.

No comments:

Post a Comment