How can I iterate over Array.prototype functions How can I iterate over Array.prototype functions arrays arrays

How can I iterate over Array.prototype functions


do you mean:

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


Using ECMAScript 6 (ECMAScript 2015), you can simplify a bit:

for (let propName of Object.getOwnPropertyNames(Array.prototype)) {   console.log(Array.prototype[propName]);}


var proto = Array.prototype;for (var key in proto) {    if (proto.hasOwnProperty(key)) {        console.log(key + ' : ' + proto[key]);    }}

demo.

And if you want to check its property in console.

Use: console.dir(Array.prototype);