07 逻辑运算符

<!DOCTYPE html>
<html>
<head>
    <title>逻辑运算符</title>
</head>
<body>
    <script type="text/javascript">
        var weather = 'sunny';
        var temp = 32;
        if (weather === 'sunny') {
            if (temp > 30) {
                console.log('再家里吹空调')
            }else{
                console.log('天气非常好')
            }
        }
        //逻辑运算 &&:and  //:or  !:取反
        if (weather === 'sunny' &&temp > 30) {
                console.log('再家里吹空调')
            }
        else if(weather === 'sunny' &&temp <= 30){
                console.log('天气非常好')
            }
        

    </script>
</body>
</html>
posted @ 2020-12-19 21:19  *!Walter!*  阅读(45)  评论(0编辑  收藏  举报