+ 1
pls explain this code
Why output is 3 ? https://code.sololearn.com/WURCXFdsJwBM/?ref=app
1 Answer
+ 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.