0

SWITCH STATEMENT

What is the output of this code? var x = 3; switch (x) { case 1: document.write(x); break; case 2: document.write(x+2); break; default: document.write(x+5); } Check Back

11th Dec 2020, 8:15 AM
टीना likesEXO
टीना likesEXO - avatar
6 Respuestas
+ 3
8 because there is no matching case and hence the default case gets executed.
11th Dec 2020, 8:20 AM
Avinesh
Avinesh - avatar
0
THANK YOU BHAIYA . i was getting a little confuse .
11th Dec 2020, 5:19 PM
टीना likesEXO
टीना likesEXO - avatar
0
3rd Apr 2022, 3:29 AM
Tyrone Baldwin
0
8
28th Sep 2022, 10:34 PM
Sinoyolo
0
but how is it 8 and not 7 or 3 or 10 ?
15th Oct 2022, 1:57 PM
Kgomotso Mdagane
Kgomotso Mdagane - avatar