This is non-standard behavior. Where (and if) it is stored until implementation.
Using Firefox 15 on Linux, I had to go through 2 prototype objects to find the actual object. I ran this code on this StackOverflow page and got the result true .
Object.getPrototypeOf(Object.getPrototypeOf(window)).hasOwnProperty("hlogo");
On Chrome on Linux, it was on par.
Object.getPrototypeOf(window).hasOwnProperty("hlogo");
I was really surprised to see it in Firefox, but since Chrome followed the Microsoft pattern, I think Firefox must have felt the need to follow suit.
If you donβt know how deep the prototype chain is, you can start the loop and add various objects to the array or just work with the objects in the loop.
var protos = [], obj = window; while (Object.getPrototypeOf(obj) !== null) { obj = Object.getPrototypeOf(obj); protos.push(obj); } alert("The object had " + protos.length + " prototype objects");
I hate lazy
source share