List Object的内置属性 [英] List Object's built-in Properties

查看:96
本文介绍了List Object的内置属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让我循环遍历Javascript对象的内置属性?

Is there a way for me to loop over a Javascript Object's built-in properties?

for ... in让我接近我想去的地方,但是A for ... in循环不会迭代内置属性。

for...in gets me close to where I want to go, but "A for...in loop does not iterate over built-in properties."

推荐答案

我意识到这个问题是三个年龄,但现在,使用ES5,有可能:

I realize this question is three years old, but now, with ES5, it is possible:

>>> Object.getOwnPropertyNames(Object)

[prototype,getPrototypeOf,getOwnPropertyDescriptor,keys ,defineProperty,defineProperties,create,getOwnPropertyNames,isExtensible,preventExtensions,freeze,isFrozen,seal,isSealed,length,arity, name,arguments,caller]

这篇关于List Object的内置属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆