Tutorials Point


  JavaScript Basics
  JavaScript Objects
  JavaScript Advanced
  JS Useful References
  JS Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Javascript - The Boolean Object


previous next AddThis Social Bookmark Button


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

Syntax:

Creating a boolean object:

var val = new Boolean(value);

If value parameter is omitted or is 0, -0, null, false, NaN, undefined, or the empty string (""), the object has an initial value of false.

Boolean Properties:

Here is a list of each property and their description.

PropertyDescription
constructor Returns a reference to the Boolean function that created the object.
prototypeThe prototype property allows you to add properties and methods to an object.

Boolean Methods

Here is a list of each method and its description.

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


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names