Determines the value of the passed object and returns the corresponding Boolean value.
JSV_toBoolean(expV)
n/a
The JSV_toBoolean
function returns all non-zero
values as true and zero values as false.
The toBoolean function uses the following argument.
Argument | Description |
expV | Any value. |
Zero values include null
, 0 (number and string),
"No" (case insensitive), false (Boolean and string) and a zero length string;
all other cases are non-zero values.
In Cold Fusion, "Yes" is true and "No" is false. This function allows the programmer to convert these values into their Boolean equivalents for use in a JavaScript function.
n/a
The following lines of code
var tc = "098";
document.write( tc + " is Boolean " + JSV_toBoolean(tc) );
tc = 0;
document.write( tc + " is Boolean " + JSV_toBoolean(tc) );
tc = "YeS";
document.write( tc + " is Boolean " + JSV_toBoolean(tc) );
tc = "nO";
document.write( tc + " is Boolean " + JSV_toBoolean(tc) );
tc = true;
document.write( tc + " is Boolean " + JSV_toBoolean(tc) );
produce
Copyright © 1998-2000 Roaring Fork Software. All rights reserved.