惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
Blog — PlanetScale
Blog — PlanetScale
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
U
Unit 42
I
InfoQ
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
B
Blog RSS Feed
Vercel News
Vercel News
F
Fortinet All Blogs
Know Your Adversary
Know Your Adversary
T
Troy Hunt's Blog
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
A
About on SuperTechFans
Jina AI
Jina AI
小众软件
小众软件
T
Threatpost
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
The Hacker News
The Hacker News
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
Scott Helme
Scott Helme
B
Blog
腾讯CDC
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
S
Schneier on Security
N
News and Events Feed by Topic
Microsoft Security Blog
Microsoft Security Blog
K
Kaspersky official blog
G
Google Developers Blog
T
Tor Project blog
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
Google Online Security Blog
Google Online Security Blog
Latest news
Latest news
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
罗磊的独立博客

博客园 - 吴博

C#类型 参考表(MSDN) 快速了解集群和双机热备相关知识 Could not find stored procedure 'sp_MSins_tablename' 当 ASP.NET 在 IIS 6.0 中锁死的情况下,如何生成转储文件 通往 WinDbg 的捷径 请教:在一个在方法段的异常处理里面,如何获取当前方法输入的所有参数值。 性能测试VS负载测试VS压力测试 Silverlight为什么不支持中文?有没有别的途径可以解决这个问题呢? 焦油坑与激情 sqlserver白皮书里的秘密 没有virtual的方法子类是否可以重写? 用记事本可以查看dll文件的release或debug依赖。 VC++.NET 2005 几个比较难缠的问题及其解决方法(转) [zt]关于Debug和Release之本质区别的讨论 vc++,不知道是不是bug。 MSMQ之确认消息 乱解 Overried与new 分区表的经典比喻
Javascript 判断 object 的特定类
吴博 · 2007-10-08 · via 博客园 - 吴博

http://www.pjhome.net/article.asp?id=679

大家都知道 Javascript 的 typeof 可以获取变量的类型, 但是 typeof 返回值只有六种 "number," "string," "boolean," "object," "function," 和 "undefined."

其实 Javascript 还有不少特殊的类别 比如 Array, Date. 为什么都不在能在 typeof 返回呢?
原来 Javascript 是把 Array Date Object 这几个都归类成 object 类了. 我们只能通过 instanceof 来判断 object 的准确类别了.

这里有个简单的例子,可以说明 instanceof 的用法


 程序代码
function objTest(obj){
   var i, t, s = "";   // 创建变量。
   t = new Array();   // 创建一个数组。
   t["Date"] = Date;   // 填充数组。
   t["Object"] = Object;
   t["Array"] = Array;
      for (i in t)
      {
         if (obj instanceof t[i])   // 检查 obj 的类。
         {
            s += "obj is an instance of " + i + "\n";
         }
         else
         {
            s += "obj is not an instance of " + i + "\n";
         }
   }
   return(s);   // 返回字符串。
}

var obj = new Date();
response.write(objTest(obj));