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

JavaScript Boolean Reference


JavaScript Booleans

JavaScript booleans can have one of two values: true or false.


The Boolean() Function

You can use the Boolean() function to find out if an expression is true:

Example

Boolean(10 > 9)        // returns true

Try it Yourself »

Or even easier:

Example

(10 > 9)              // also returns true
10 > 9                // also returns true

Try it Yourself »

For a tutorial about booleans, read our JavaScript Boolean Tutorial.


Boolean Properties

Property Description
constructor Returns the function that created JavaScript's Boolean prototype
prototype Allows you to add properties and methods to the Boolean prototype

Boolean Methods

Method Description
toString() Converts a boolean value to a string, and returns the result
valueOf() Returns the primitive value of a boolean



Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook