+ 1

pls explain this code

Why output is 3 ? https://code.sololearn.com/WURCXFdsJwBM/?ref=app

28th Aug 2017, 7:25 AM
ARB
ARB - avatar
1 Antwort
+ 8
var x = 2; if (true || false && x > 0 ) { document.write (x + 1); } else { document.write (x -1) ; } true || false && x > 0 evaluates to true. Hence x + 1 is output. Outputs 3.
28th Aug 2017, 7:31 AM
Hatsy Rei
Hatsy Rei - avatar