JS之typeof

来源:互联网 发布:java socket.flush 编辑:程序博客网 时间:2024/06/07 01:48
<!DOCTYPE html><html><head><meta charset="utf-8"><title>title</title></head><body> <script type="text/javascript">var number = 123;var string = "string";var object = new Object();var fun = function(x){return x*x};var date = new Date();var pattern = /[a]t/g;var bool = true;var Bool = new Boolean(true);var undifined;var nullvalue = null;var array = [1, 2, "3"];alert(typeof(number) + ":number");alert(typeof(string) + ":string");alert(typeof(object) + ":object");alert(typeof(fun) + ":function");alert(typeof(date) + ":object");alert(typeof(pattern) + ":object");alert(typeof(Bool) + ":object");alert(typeof(bool) + ":boolean");alert(typeof(undifined) + ":undifined");alert(typeof(nullvalue) + ":object");alert(typeof(array) + ":object");</script></body></html>

0 0
原创粉丝点击