JavaScript “This”
[JL’s Coding Bootcamp Story] Series
JavaScript “Scope & Closure”
JavaScript “This”(Current)
JavaScript “Call, Apply, Bind”
Summary of CodeSchool’s “Try jQuery”
JavaScript “This” — Advanced
JavaScript “Code Reuse” — Part 1–1: Decorators
JavaScript “Code Reuse” — Part 1–2: Functional Classes
JavaScript “Prototype Chains”
JavaScript “Code Reuse” — Part 2–1: Prototypal Classes
JavaScript “Code Reuse” — Part 2–2: Pseudo-classical Classes
#This
“This” is one of elements within “execution context,” which is created when a function is called (= when a scope is created). “Execution context” consists of the following : 1. caller(callee) 2. arguments 3. global & local variable(s) & function within a scope chain 4. this.
There are 5 patterns of binding “this” : 1. global reference 2. free function invocation 3. .call or .apply invocation 4. construction mode 5. method invocation.
[Default — Window] 1. Global Reference & 2. Free Function Invocation
[Exception №1 — First Argument] 3. .call or .apply Invocation
[Exception №2 — New Object] : 4. Construction Mode
[Exception №3 — Parents Object] : 5. Method Invocation
[Note] This blog post is written based on a lecture from CodeStates.
Thanks for reading! 💕 If you like this blog post, please clap👏