Closed WordsofDefiance closed 5 years ago
Where did you guys say this earlier? scope and closure book, appendix A
https://github.com/getify/You-Dont-Know-JS/blob/master/scope%20%26%20closures/apA.md
At the end of the appendix you find what you want:
The key contrast: lexical scope is write-time, whereas dynamic scope (and this!) are runtime. Lexical scope cares where a function was declared, but dynamic scope cares where a function was called from.
Finally: this cares how a function was called, which shows how closely related the this mechanism is to the idea of dynamic scoping. To dig more into this, read the title "this & Object Prototypes".
(clearing out issues for second edition work)
I'm reading through the first chapter of the book about this and object prototypes.
Where did you guys say this earlier? I definitely missed it if you did. in fact, we don't get a working definition of
this
until the end of the chapter.This seems like an oversight, but apologies if this is intentional!