You-Dont-Know-JS icon indicating copy to clipboard operation
You-Dont-Know-JS copied to clipboard

Add some 'why' explanation to the 4 ways that `this` is set

Open michaelmcandrew opened this issue 8 years ago • 2 comments

You briefly introduce this here https://github.com/getify/You-Dont-Know-JS/blob/master/up%20%26%20going/ch2.md#this-identifier and here https://github.com/getify/You-Dont-Know-JS/blob/master/up%20%26%20going/ch3.md#this--object-prototypes.

I know that you don't want to get into details about these four methods, and that you'll do so in a later title, but I think the reader would benefit from a sentence that explains at a high level, what the thinking behind it being set in four different ways is. Why it is useful or necessary to understand it.

I'm thinking about something similar to what you have written about closure and modules (One important application of closure is the module pattern, as we briefly introduced in this book in Chapter 2. The module pattern is perhaps the most prevalent code organization pattern in all of JavaScript; deep understanding of it should be one of your highest priorities.). Something that sparks the readers imagination and helps fire some neurons before they get to the chapter.

I haven't read the rest of the book yet so there may be a good reason why you don't do this, but I wanted to feed back now to give you the perspective of a new reader (it might be that when I know more about this, I don't find the lack of context so significant).

PS. Loving the book so far :)

michaelmcandrew avatar Apr 18 '17 09:04 michaelmcandrew

Thanks, this is a great suggestion. :)

getify avatar Apr 18 '17 11:04 getify

ok, great - glad it was useful :)

michaelmcandrew avatar Apr 18 '17 12:04 michaelmcandrew