, , . + number, -. ! not boolean (true/false).
, , - , Javascript - . "" "" , "" ( , AKA NaN).
, JSFiddle Firebug , , , - .
:
!function(){} false ( true).+function(){} NaN ( NaN). , -.!+function(){} true ( NaN false, false true.!+-+-+!function(){} true ( !function(){} false, +false 0 + -, , , !0 true).- Using the operators, as they are listed in your example, will go back and forth between
false, -1, 0, 1 true, until all the operators are evaluated.
Please note that I tested them with Firebug. There may be differences between browsers and, perhaps, what Firebug shows us when evaluating. TL DR is that Javascript does many types of coercion and will evaluate expressions differently than declarations.
source
share