弱类型语言的布尔值转换

  In some languages (e.g. C), the boolean values are defined as actual numerical values, so they are just different names for

1 and 0 (or -1 and 0).

  In some other languages (e.g.  Java),treats boolean as a completely separate data type which has 2 distinct values: true and false.

The values 1 and 0 are of type int and are not implicitly convertible to boolean.

  Javascript falls in the category that has a distinct boolean type, but on the other hand Javascript is quite keen to convert values

between different data types.

posted @ 2014-01-22 21:10  等风来。。  Views(187)  Comments(0Edit  收藏  举报
------------------------------------------------------------------------------------------------------------ --------------- 欢迎联系 x.guan.ling@gmail.com--------------- ------------------------------------------------------------------------------------------------------------