Can we get lookup count for object3.x?
First – look into owned property – no x
Second – look into prototype object of object3 ->object2 – no x
Third – look into prototype object of object2 -> object 1 – x defined – yes
object1 = {x:1};
object2 = Object.create(object1);
object2.y = 2;
object3 = Object.create(object2);
object3.z = 3;
object1.x; // lookup count = 1
object2.x; // lookup count = 2
object3.x; // lookup count = 3
You could create a function for that purpose…