比较运算

2018-04-02  本文已影响0人  Clayten
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        //与数字比较
/*      var a = 10; 
        var b = 20;
        var c = a > b;
        var c1 = a < b;
        var c2 = a == b;
        var c3 = a != b; 
        var c4 = a <= b;
        var c5 = a <= a; 
        var c6 = a >= a;
        console.log(c,c1,c2,c3,c4,c5);//false,true,false,true,true,true
        var c7 = a && true;
        console.log("c7 = "+c7);*/
        //与Boolean比较
/*      var a = 10;
        var b = true;
        var c = false;
        console.log(a > b,a > c,b > c);*/
        //与字符比较
        var a = "a";
        var b = "10";
        console.log(a > b);
    </script>
</body>
</html>
上一篇下一篇

猜你喜欢

热点阅读