The special features of the operators & quot; | & quot; and & quot; & amp; & quot; In JScript are used to simplify the code into many operators in JScript, three logical operators are provided.
&&,
|And
!Oh ?! Is provided in advanced languages. According to our normal understanding of logical operations, the logical operation result should be true or false. However, the logic operations of JScript are not exactly defined in this way. Only! The true | false operator is always returned, and | is more fun.
JScript defines true or false for logical operations as follows:
All objects are considered true.
String is considered as false only when it is null ("" or.
NullAnd undefined are regarded as false.
The value is false only when the value is 0.
But logical operators|And&&Although the above defined rules are followed, the returned values are very interesting.
For & operations, according to the above rules, if ('abc' & '000000' & new Date () is the true branch, but this expression is written as follows:
I tested it in Firefox and the results are the same!