How to get the object type in javascript:
来源:互联网 发布:网络翻译英文兼职 编辑:程序博客网 时间:2024/06/05 18:25
var obj = {}; // any object
1. typeof:
typeof obj; // object
2. instanceof:
obj instanceof Object; // true
3. Object.prototype.toString:
Object.prototype.toString.call(obj); // [object Object]
4. constructor:
obj.constructor // Object
5. Duck:
typeof obj === "object" && "hasOwnProperty" in obj && "toString" in obj; // true
Reference Material: http://www.iteye.com/topic/318821
- How to get the object type in javascript:
- How do I get the name of an object's type in JavaScript
- How to get a type in C++ when its template argument is the argument
- How to inherit an Object in JavaScript
- How to clone an object in JavaScript
- Silktest2011:How to get Browser type in openagent model?
- How to get the published properties of an persistent object
- How to access the keys in dictionary in object-c
- In RadGrid, How to get the control inside usercontrol
- how to get the function back trace in php
- How to schedule and get the report in SCOM2012
- How to get the HttpServletRequest in Struts 2
- How to get the JSON results in ExtJS
- How to get the dmesg output in initramfs (debian)
- How to get the query string by javascript?
- How to get the query string by javascript?
- How to Get the WDK
- How to get value of the person or group type via CAML Query js
- Sql缓存依赖的实例
- Apache Ant Ivy 笔记
- 一个项目部署引发的“血案”
- POJ_1011 DFS+剪枝
- DropDownList 绑定xml 数据
- How to get the object type in javascript:
- 装箱和拆箱。享元对象
- 如何学好C++语言
- 从植物大战僵尸看项目管理
- 试验帖子
- FX3U解密软件已开发成功,完美读出程序、参数、软元件区数据
- 尊重规律
- C# socket,Tcp和Udp
- 偷菜游戏,悄悄开启毁灭中国的魔盒