“This” in JavaScript
bjorn.tipling.com
“This” in JavaScript
1–10 of 99 posts
Re: “This” in JavaScript
#2https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re: “This” in JavaScript
#3When I transitioned from PHP to Python, the change in nomenclature (albeit only a social norm in Python) was a big part of what helped me think bigger about this concept.
To this point, this read might have been easier to digest had it started with the section "object this."
Re: “This” in JavaScript
#4Not mentioned are ES6's arrow functions that capture the `this` value of the enclosing context. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re: “This” in JavaScript
#5Re: “This” in JavaScript
#6context.func() //this == context
func() // this == global
Re: “This” in JavaScript
#7(great essay BTW on a hated subject :-)
Re: “This” in JavaScript
#8There's something to be said about the distinction between "this" and "self" as names for the self-referential instance object. While "self" emphasizes mutability and introspection, "this" evokes a more material, evidentiary abstraction. When I transitioned from PHP to Python, the change in nomenclature (albeit only a social norm in Python) was a big part of what helped me think bigger about this concept. To this poi…
Maybe it's just because I'm familiar with C where the equivalent of a "this" reference often has a different name depending on the "class", e.g. "struct Window * w" or "struct Button * b".
Re: “This” in JavaScript
#9Not mentioned are ES6's arrow functions that capture the `this` value of the enclosing context. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
TypeScript has these and they're marvelous. They make writing functional style code very enjoyable and not having to capture `this` yourself is alone justification for this developer to never go back to pure JavaScript.