Switch

var variable = "2"

switch (variable) {
    case "1":
        console.log("1")
    case "2":
        console.log("2")
    case "3":
        console.log("3")
}
実行結果
2
3

Switch-break

var variable = "2"

switch (variable) {
    case "1":
        console.log("1")
        break
    case "2":
        console.log("2")
        break
    case "3":
        console.log("3")
        break
}
実行結果
2

Switch-default

var variable = "4"

switch (variable) {
    case "1":
        console.log("1")
        break
    case "2":
        console.log("2")
        break
    case "3":
        console.log("3")
        break
    default:
        console.log("default")
}
実行結果
default