Boolean
The Boolean object is a wrapper object used for storing primitive boolean values.
Syntax
The syntax for this object is:
new Boolean(value) //Value stored by Boolean object.//Or
Boolean(value) //Value converted to a boolean value.
Where:
value represents the value to be stored by the Boolean object or to be converted to a boolean value.
Sample
<?xml version="1.0"?>
<!DOCTYPE vxml PUBLIC "-//Nuance/DTD VoiceXML 2.0//EN"
"http://voicexml.nuance.com/dtd/nuancevoicexml-2-0.dtd" >
<vxml version="2.0">
...
<script>
<![CDATA[
var prompt;
var numberCombination
//Creating a Boolean object and setting its value to true.
var winningCombination = Boolean('true'); if(numberCombination == winningCombination){ prompt = "Congratulations, you won the lottery!";
}
else{prompt = "Sorry, please play again.";
]]>
</script>
...
</vxml>
Properties
This section describes the Boolean object properties.
The constructor property identifies the function used to create the Boolean object’s prototype.
The syntax for this property is:
Boolean.constructor
The prototype property is used to add new methods and properties to the Boolean object.
The syntax for this property is:
Boolean.prototype.methodBoolean.prototype.property
Methods
This section describes the Boolean object methods.
The toString method returns a string representation of the primitive boolean value stored in the object.
The syntax for this method is:
boolean.toString()
The valueOf method returns the boolean value stored by the object.
The syntax for this method is:
boolean.valueOf()