X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript Boolean toString() Method

JavaScript Boolean Reference JavaScript Boolean Reference

Example

Convert a Boolean value to a string:

var bool = true;
var x = bool.toString();

The result of x will be:

true

Try it yourself »


Definition and Usage

The toString() method returns a boolean value as a string.

Note: This method is called by JavaScript automatically whenever a boolean is used in a string operation.


Browser Support

Method
toString() Yes Yes Yes Yes Yes


Syntax

boolean.toString()

Parameters

None.

Technical Details

Return Value: A String, either "true" or "false"
JavaScript Version: 1.1


JavaScript Boolean Reference JavaScript Boolean Reference

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