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.

Related questions

0 votes
asked Oct 9, 2022 in JavaScript by Robin
0 votes
asked Mar 23, 2021 in JavaScript by sharadyadav1986
...