0 votes
in JavaScript by

Which of the following is the correct output for the following JavaScript code:

var x=3;  

var y=2;  

var z=0;  

If(x==y)  

document.write(x);  

elseif(x==y)  

document.write(x);  

else  

document.write(z);  

a) 3

b) 0

c) Error

d) 2

1 Answer

0 votes
by

Answer: B

Reason: The "if-and if" statement is used to examine more than one condition. This is an extension of the "if-else" statement and is also known as the "if-else ladder". We can extend the "if-else" statement to check several conditions.

Related questions

0 votes
asked Mar 20, 2021 in JavaScript by sharadyadav1986
0 votes
asked Mar 21, 2021 in JavaScript by rajeshsharma
...