(01)javascript 数据类型

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script type="text/javascript">
        function f() {

        }
        var s = "";
        s+="typeof true:\t\t\t"+typeof true+"\n"
        s+="typeof 3.3:\t\t\t\t"+typeof 3+"\n"
        s+="typeof 'hello':\t\t\t"+typeof 'hello'+"\n"
        s+="typeof f :\t\t\t\t"+typeof f+"\n";
        s+="typeof new Array(1,2,):\t"+typeof new Array(1,2)+"\n"
        s+="typeof [1,3]:\t\t\t"+typeof [1,3]+"\n"
        s+="typeof null:\t\t\t"+typeof null+"\n"
        s+="typeof undefined:\t\t"+typeof undefined+"\n"
        console.log(s)

        /*结果如下:
        typeof true:            boolean
        typeof 3.3:             number
        typeof 'hello':         string
        typeof f :              function
        typeof new Array(1,2,): object
        typeof [1,3]:           object
        typeof null:            object
        typeof undefined:       undefined*/
    </script>
</head>
<body>

</body>
</html>
posted @ 2016-06-21 18:13  岳麓丹枫  阅读(66)  评论(0编辑  收藏  举报