Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 4 made on Sunday October 3, 2010 at 05:41
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
13,006
Strings are really funny when cast to booleans. An empty string will evaluate to boolean false. A string with a single space (or non-empty string) will always evaluate to boolean true. This is by design and IIRC, is discussed in Flanagan.

In practice, you'd want something other than 'false' to evaluate to true. In this case, you can use the Boolean function or use the Boolean Wrapper function and use valueOf() call to the resulting object.

[Link: w3schools.com]

Then, try the tutorial and note the last line of the example output that adheres to my first statment. This is not quite what one would expect from the language but it is what it is.

[Link: w3schools.com]

The only real way to see if the value is 'true' is by string comparison.
(str == 'true')

You can make this a bit more flexible this a bit by doing:
(str.toUpperCase() == 'TRUE')
Lyndel McGee
Philips Pronto Addict/Beta Tester


Hosting Services by ipHouse