Considering below JS snippet. It prints 1 and 2 both even if case: 2
is not a match!
I know, I can put a break;
to prevent this, but I want to understand the real logic behind this. As this doesn't make sense to execute a block when there is no match.
var a = 1
switch(a){
case 1:
console.log(1)
case 2:
console.log(2)
}