Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

Boolean.parse Function

Converts a string representation of a logical value to its Boolean Object object equivalent. This function is static and can be invoked without creating an instance of the object.

Syntax

var booleanVar = Boolean.parse("true");

Arguments

Term

Definition

value

A string representation of either true or false.

Return Value

A Boolean value (true or false) that corresponds to the value argument.

Exceptions

Exception Type Condition

argumentOutOfRange Function

(Debug) value does not contain a string representation of true or false.

Remarks

Use the parse function to create a Boolean value from a string representation. The value argument must be "true" or "false" (case insensitive). The string can contain white space. If the string cannot be converted to a Boolean value, an exception is thrown.

Example

The following example shows how to use the parse function to create a Boolean value from a string.

JavaScript

var a = new Boolean(true);      
if (a == true){
    alert("a = true"); 
}else{
    alert("a = false");
}

var b = Boolean.parse("true");
if (b == true){
    alert("b = true"); 
}else{
    alert("b = false");
}