js中 swith 与 break位置的细节

    function aa(a) {
        switch (a) {
            case 1:
                console.log("A")
                break;
            case 2:
                console.log("B")
            case 3:
                console.log("C")
            case 4:
                console.log("D")
                break;

        }
    }
    aa(2);

输出结果为

B
C
D

流程框图为

猜你喜欢

转载自blog.csdn.net/qaqLjj/article/details/83317168
今日推荐