美文网首页
比较运算

比较运算

作者: Clayten | 来源:发表于2018-04-02 12:19 被阅读0次
    <!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>
    

    相关文章

      网友评论

          本文标题:比较运算

          本文链接:https://www.haomeiwen.com/subject/ptpthftx.html