Please enable JavaScript.
Coggle requires JavaScript to display documents.
JS/ES - Coggle Diagram
JS/ES
-
-
:fire: Execution Context
-
-
Creation Phase
-
:star: Hoisting
-
-
3 - Hoisting means to declare variables and functions as undefined in memory until store data inside of them.
2 - During the hoisting, Call Stack asks from Memory Heap to allocate some memory for variables and functions during creation phase.
-
-
-
-
-
-
-
-
:star: this
-
-
-
-
3 - It matters how the function was called! functions inside a method in object have access to global object! :(
Arrow Functions is a way to solve issue. In arrow functions, 'this' is lexically scoped!
-
-
-
:star: Scope
-
-
Leakage of global variables: Example
Function Scope vs Block Scope: Example
-
-
Function
Creating
-
Expression
With 'var', 'let' or 'const'
-
-
-
-
-
-
-
-
-
Optimization
-
Inline Caching : With inline caching, in multiple times to call a function, compiler sets the previous result of the function instead of calling it again. Example
-
:star: Closure
Definition
Allows a function to access variables from an enclosing scope even after it leaves scope in which it was declared.
-
-
-
-
-
-
-
Functional Programming
-
Pure Function
2 rules
-
2 - The function has to always return the same output with the same input (Referential Transparency)
console.log()
is an api, so it breaks pure function
-
-
-
-
-
currying
Definition
It's the technique of translating the evaluation of a function that takes multiple arguments into evaluating a sequence of functions each with a single argument.
-
-
Composition
Any data transformation, should be obvious
-
pipe (It's invert of composition) Example
-
-
-
-