0 votes
in JavaScript by

What if we put ++ operator inside if condition? find the output of below code

<script>

var a = 10;

if(a == a++)

document.write(a);

</script>

a) Error

b) Nothing is printed

c) 10

d) 11

1 Answer

0 votes
by

Answer:-  D

reason:-During initialization the value of variable a is 10.But after if condition it becomes 11 due to "a++" in if condition.

...