0 votes
in JavaScript by
Which of the following is the correct output for the following JavaScript code:

Int x=8;  

if(x>9)  

{  

document.write(9);  

}  

else  

{  

document.write(x);  

}  

a) 9

b) 0

c) 8

d) Undefined

1 Answer

0 votes
by

Answer: C

Reason: The "if-else" is one of the conditional statements available in JavaScript like several other languages. Here the comparison performed in the "if" statement evaluates to false, so the instructions written in the else part gets executed. If the comparison performed in the "if" statement evaluates to true, then the instruction written in the if statement will be executed.

...