0
Why is this result?
document.write(1&&2)==2
3 Answers
+ 4
a&&b returns a if it it can be interpreted as false, and b otherwise. And any non-zero value is interpreted as true. So 1&&2 is evaluated as 2.
(You see Venkatesh's answer? This is why you should words instead of ==. People confuses that with actual code.)
+ 1
My guess is this will lead to compilation error.
Because of braces placement. braces is only for a&&b and write will not return any values. So it will report an error
- 5
hjkl