码迷,mamicode.com
首页 > Web开发 > 详细

js判断object的具体类型(或者说判断object的类class)

时间:2017-08-29 21:53:26      阅读:383      评论:0      收藏:0      [点我收藏+]

标签:div   asc   log   help   targe   back   bar   determine   over   

The JavaScript specification gives exactly one proper way to determine the class of an object:

Object.prototype.toString.call(t);

http://bonsaiden.github.com/JavaScript-Garden/#types

技术分享

 https://stackoverflow.com/questions/7893776/the-most-accurate-way-to-check-js-objects-type

The typeof operator doesn‘t really help us to find the real type of an object.

I‘ve already seen the following code :

Object.prototype.toString.apply(t)

Question:

Is it the most accurate way of checking the object‘s type?

 

js判断object的具体类型(或者说判断object的类class)

标签:div   asc   log   help   targe   back   bar   determine   over   

原文地址:http://www.cnblogs.com/oxspirt/p/7450083.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!