HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript Booleans


The Boolean object is used to convert a non-Boolean value to a Boolean value (true or false).


Examples

Try it Yourself - Examples

Check Boolean value
Check if a Boolean object is true or false.


Complete Boolean Object Reference

For a complete reference of all the properties and methods that can be used with the Boolean object, go to our complete Boolean object reference.

The reference contains a brief description and examples of use for each property and method!


Create a Boolean Object

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

The following code creates a Boolean object called myBoolean:

var myBoolean=new Boolean();

If the Boolean object has no initial value, or if the passed value is one of the following:

  • 0
  • -0
  • null
  • ""
  • false
  • undefined
  • NaN

the object is set to false. For any other value it is set to true (even with the string "false")!


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE