对象的枚举

1、for...in...循环

  for( var  key  in  obj ){

    console.log( key )  // 对象属性名

  }

2、hasOwnProperty

  obj.hasOwnProperty( key )

  判断一个属性是不是对象自身的属性

3、in

  'key'  in  obj

  判断一个属性是不是对象自身或原型上的属性

4、instanceof

  A  instanceof  B

  看A对象的原型链上  有没有  B的原型

5、区别数组和对象的方法

  instanceof

  constructor

  Object.prototype.toString.call( )

原文地址:https://www.cnblogs.com/cuishuangshuang/p/13276636.html