网站开发技术

记点笔记、 学点技术 欢迎交流建站技术。本站关注lamp技术

您尚未登录。

#1 2014-12-18 10:04:24

jquery
版主

js 中的数据类型有六种, 使用 typeof 可以产看

js 中的数据类型, 函数也是一种数据类型

<script>
    w = function(type) {
document.writeln("<pre> typeof(" + type + ") :" + typeof (type) + " </pre>");
    };

    w('1');
    w(1);
    w(w);
    w(false);
    w(undefined);
    w(window);
</script>

打印的结果

<pre> typeof(1) :string </pre>

<pre> typeof(1) :number </pre>

<pre> typeof(function (type) {
document.writeln("<pre> typeof(" + type + ") :" + typeof (type) + " </pre>");
    }) :function </pre>
    
<pre> typeof(false) :boolean </pre>

<pre> typeof(undefined) :undefined </pre>

<pre> typeof([object Window]) :object </pre>

<a href="http://www.ipbbs.net/viewforum.php?id=4"> jquery教程</a>

离线

页脚

Powered by FluxBB