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

var grade='Z';  

var result;  

switch(grade)  

{  

case'A':  

        result+="10";  

case'B':  

        result+=" 9";  

case'C':  

        result+=" 8";  

default:  

        result+=" 0";  

}  

document.write(result);  

a) 10

b) 17

c) 18

d) 0

1 Answer

0 votes
by

Answer: D

Reason: The switch case statement contains several cases in which the Default case also one of them. The default case only is get executed, when no other case matches with the expression's value.

Related questions

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