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);  
}  

since the condition is false so else part is executed so ans is 8

1 Like

8 will print becuase x = 8 and value of x is less then 9 so it will print x = 8

1 Like