As you might expect, scope object might have parent. When the code tries to access some variable, interpreter looks for the property of current scope object. If the property doesn’t exist, interpreter moves to the parent scope object, and looks there. And so on, until the value is found, or there’s no more parent. Let’s call this sequence of scope objects as a scope chain.
The behavior of resolving a variable on scope chain is very similar to that of prototypal inheritance, with, again, one notable difference: if you try to access some non-existing property of regular object, and prototype chain doesn’t contain this property either, it’s not an error:
undefined is silently returned. But if you try to access non-existing property on the scope chain (i.e. access non-existing variable), then