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?
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]);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With