
Originally Posted by
Pepejeria
I am actually doing that solution now. But it felt somehow cheap compared to what Java offers. It is a pity that the Boolean wrapper object doesn't work like it does in Java. But hey, I know, JavaScript is not Java. I wish it would be more like Java and less like Python, which it is becoming lately (JavaScript 1.7 and the upcoming 1.8).
Technically, what java does is not a typecast, but the Boolean(Stirng) constructor, that arbitrarily interprets the string "true" as boolean true. Nice? I find this kind of code rather stinky 
Code:
Boolean a = new Boolean("true"); // true
Boolean b = new Boolean("true "); // FALSE
Bookmarks