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

JavaScript Boolean toString() Method

Boolean Object Reference JavaScript Boolean Object

Example

Convert a Boolean value to a string:

var bool = new Boolean(1);
var myvar = bool.toString();

The result of myvar will be:

true

Try it yourself »

Definition and Usage

The toString() method converts a Boolean value to a string, and returns the result.

Note: This method is called by JavaScript automatically whenever a Boolean object is used in a situation requiring a string.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The toString() method is supported in all major browsers.


Syntax

boolean.toString()

Parameters

None.

Return Value

Type Description
String Either "true" or "false"

Technical Details

JavaScript Version: 1.1


Boolean Object Reference JavaScript Boolean Object

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