Thursday 25 June 2020

32- Web Designing Question - 12


var a = 10; 

 if(a == a++)   

document.write(a);

(A)    Error

(B)    Nothing is printed

(C)    10

(D)   11



 

if(10==10++)

Here a++ is the postfix operator so in if statement is will be 10 so condition is true and value of a became 11 after if so the final output is 11

 

Option (D) 11 is correct 

No comments:

Post a Comment