1 2 3 4 5 6列出所有的属性键 7 8 9 10 11
1 function getAllpropertyNames(obj){ 2 var result=[]; 3 while(obj){ 4 Array.prototype.push.apply(result,Object.getOwnPropertyNames(obj)); 5 // obj = Object.getPrototypeOf(obj); 6 } 7 return result; 8 } 9 10 var all = getAllpropertyNames(Array);11 12 console.log(all);