Andrea Giammarchi (2013-05-08T20:54:42.000Z)
github at esdiscuss.org (2013-07-12T02:27:21.639Z)
in the Example 1 you simply loop over all keys in the chain, included the `x` inherited from `b`. The fact you shadow that is irrelevant, it was there in any case. The fact you get 1 in the log is because you access the shadowed property through `a[i]` so expected result. You are doing a for/in, not a for/of In the second Example is the same, for/in loops over all enumerable properties in the chain, it does not matter what you do with the current instance if that property name is inherited so, once again, expected. ```js var b = { x : 2 }, a = { y : 0, __proto__ : b }, k; for (k in a){ alert(k + ": " + a[k]); delete b.x; // note: it's b, not a } ``` this will loop only over `a.y` skipping `x` If you want to be sure about having a keys snapshot of the own properties, you can, in ES6: ```js let b = {x: 2}, a = {y: 0, __proto__: b}, k; for (k of Object.keys(a)) { console.log(k); } ``` or an equivalent for loop/iteration over keys such ```js Object.keys(a).forEach(function(k){ this[k]; // whatever }, a); ```