Confusing operator


Arithmetic operators:

the console.log (undefined + NaN3) // NaN3
the console.log (+ undefined null) // NaN3
the console.log (+ undefined null) // NaN3
the console.log (+ NaN3 null) // NaN3
Console. log (. 1 + null) // A
to true equivalent. 1;
to false and a null is equivalent to 0;
the console.log ( ". 1" + null ) 1null
1+ {name: "ADMIN"} // [Object Object]
1+ [ 3,4,5,6] // 13,4,5,6

conclusion: as long as the string concatenation, will become the string. NaN3 is added to the special value. As the character arrays together.

Logical Operators&&:
console.log(undefined&&NaN) //u
console.log(undefined&&null) //u
console.log(null&&undefined) //n
console.log(NaN&&null) //n
console.log(1&&null) //null
console.log("1"&&null) //null
 
Conclusion: The special value && special value, who wrote the previous results is who. Null any phase value results are null (except special value). And false && think, are false; 0 and phase were 0; 
0 and 0 false phase; and a digital phase 1;










Guess you like

Origin www.cnblogs.com/hy96/p/11369595.html
Recommended