• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Boolean() > Description

Description

There are really only two native instances of Boolean() from a JavaScript point of view: the true value and the false value. JavaScript provides the Boolean() constructor function for three reasons. The first is to give a simple conversion function into a true/false setting. The second is to associate certain properties and methods via prototyping with the true and false values, in order to make them true objects in the language. The third is to provide for the construction of instances of Boolean() that can accept new properties.

Defining Boolean() Objects by Comparison

Whenever you ask JavaScript to compare two items in an if...else statement, you create a boolean value that determines which branch of the if...else statement executes.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint