1

Is there a way to see all the prototypical properties of an array [] or hash {} in Chrome's Dev Tools? I want to illustrate that each time you create a new array or hash you also get a whole slew of properties that come with that array.

For some reason console.log(Array.prototype); doesn't work for me on my Dev Tool (Linux Chrome

For some reason console.log(Array.prototype); doesn't work for me on my Dev Tool (Linux Chrome)

console.dir(Array.prototype); worked for me.

fuzzybabybunny
  • 5,146
  • 6
  • 32
  • 58

3 Answers3

2

If you create a new array you can also view it's contents including all inherited Array.prototype properties using console.dir().

var arr = [1,2,3,4,5];
console.dir(arr);
Edgar Sanchez
  • 246
  • 1
  • 5
1

If you want to see the protypical properties of an existing array, you can use

console.dir(arrayName.__proto__);

enter image description here

sn_92
  • 488
  • 3
  • 11
0

U can use console.log(Array.prototype);

img

Stvenoo
  • 67
  • 5