I have the following switch simple case:
let ca: string = "2";
switch (ca) {
case "2":
console.log("2");
case "1":
console.log("1");
default:
console.log("default");
}
I'm trying to understand why the output of this code is:
2
1
default
My expected output is
2
default
why its print
1
even if ca isn't equal "1"?
EDIT: I know that I can add break
statment - I just trying to understand why case "1"
occurred if ca="2"
Thanks.