Chris
Member since Jul 12, 2012
- Profile: /members/10116-chris.htm
- Comments: 2
Recent Blog Comments By Chris
-
Javascript's Implicit Boolean Conversions
Posted on Jul 12, 2012 at 7:05 AM
You are right I think not false is true - since boolean logic means !false => true ;) As I wrote before a boolean evaluation of a string is different to the evaluation of a boolean. You cannot really compare a different datatype to a boolean (except of 0,1,'0','1') like you can compare a string ... read more »
-
Javascript's Implicit Boolean Conversions
Posted on Jul 12, 2012 at 3:22 AM
@Iulian: Your 2nd test ('true'?1:2) throws the true because it is just not false. You could write everything in the string (eg 'yourteststring'?1:2 or even 'false'?1:2). Every string that is not empty is not false. It is evaluated like this 'something'.length?1:2 so with this you can perfectly test ... read more »