如何迭代Array.prototype函数 [英] How can I iterate over Array.prototype functions
本文介绍了如何迭代Array.prototype函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将所有数组函数包装在数组对象中,但是在控制台中
I want to wrap all Array functions in array object, but in console
>>> Array.prototype
[]
>>> [].prototype
undefined
但是当我输入数组时。原型
在控制台中显示自动填充中的所有功能,我该如何获得这些功能?它们隐藏在哪里?
but when I type Array.prototype
in console it show all functions in autocomple, how can I get those functions? Where are they hidden?
推荐答案
你的意思是:
var arrObj = Object.getOwnPropertyNames(Array.prototype);
for( var funcKey in arrObj ) {
console.log(arrObj[funcKey]);
}
这篇关于如何迭代Array.prototype函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文