Could you explain it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Could you explain it?

var sub = 'Eng'; switch (sub) { case 'Eng': document.write(1); case 'Es': document.write(2); } // output '12'

29th Mar 2020, 2:20 PM
Nikolay Romeiko
Nikolay Romeiko - avatar
2 Answers
+ 4
Because there is no break statement between the cases.
29th Mar 2020, 2:22 PM
Gordon
Gordon - avatar
0
Thanks
29th Mar 2020, 2:24 PM
Nikolay Romeiko
Nikolay Romeiko - avatar