首页 > 其他 > 详细

switch做判断的时候用的是===而不是==

时间:2019-12-20 14:58:07      阅读:89      评论:0      收藏:0      [点我收藏+]
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<script>
    let a = 2;
    switch (a) {
        case 1:
            console.log(1);
            break;
        case 2:
            console.log(2);
            break;
        case 3:
            console.log(3);
            break;
        case 4:
            console.log(4);
            break;
        default:
            console.log(没有匹配的)
    }
</script>
</body>
</html>

switch做判断的时候用的是===而不是==

原文:https://www.cnblogs.com/ustc-yy/p/12072836.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!