首页 > Web开发 > 详细

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

时间:2017-08-29 21:13:52      阅读:307      评论:0      收藏:0      [点我收藏+]

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)

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!