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

 

相关文章:

  • 2022-02-03
  • 2021-08-28
  • 2022-02-10
  • 2022-01-17
  • 2022-12-23
  • 2021-07-20
  • 2021-11-30
  • 2021-08-18
猜你喜欢
  • 2021-06-26
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2021-05-23
  • 2022-01-06
相关资源
相似解决方案