What will be the output of the following JavaScript code?
var grade=’E’;
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) 0
c) 18
d) 17
Answer: b
Explanation: The switch case contains a default case along with the other cases. The default case gets executed when no other case results into true.
Related Posts
The meaning for Augmenting classes is that ___________
The basic difference between JavaScript and Java is _________
What will be the output of the following JavaScript code?
var o = new F();
o.constructor === FThe keyword or the property that you use to refer to an object through which they were invoked is _________
The behaviour of the instances present of a class inside a method is defined by __________
What will be the output of the following JavaScript code?
var a=225;
document.writeln(Math.sqrt(a));What will be the output of the following JavaScript code?
var a=2.99;
var ans=floor(a)*floor(a)
console.log(ans);
Join The Discussion