COPYRIGHT © 2018 CodeStates

#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👏

--

--