jcubic jcubic - 4 months ago 11
Javascript Question

How can I iterate over Array.prototype functions

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?

Answer

do you mean:

var arrObj = Object.getOwnPropertyNames(Array.prototype);
for( var funcKey in arrObj ) {
   console.log(arrObj[funcKey]);
}