JS.string.空_测试

1、

<!DOCTYPE html>

<html>
<head>
    <meta charset="UTF-8">

    <script type="text/javascript" >
    <!--

        window.onload = function()
        {
            var str = "";
            if (str)
                console.log("str is not empty .");
            else
                console.log("str is empty .");

            console.log("");

            str = " ";
            if (str)
                console.log("str is not empty .");
            else
                console.log("str is empty .");
        };

    -->
    </script>

</head>

<body>
</body>
</html>

  1.1、Win7x64 chrome(版本 68.0.3440.106 (正式版本) (32 位)) 控制台输出:

test_string_splt.html:16 str is empty .
test_string_splt.html:18 
test_string_splt.html:22 str is not empty .

 

2、

3、

4、

5、

 

posted @ 2018-09-06 09:54  Html5Skill  阅读(105)  评论(0编辑  收藏  举报