Please enable JavaScript.
Coggle requires JavaScript to display documents.
Advanced JavaScript (Scope (Decorations (assignment (LHS, RHS: No…
Advanced JavaScript
Scope
function scope, block scope
Decorations
var, function, value assignment. (the order also implies which one gets executed first)
-
Hoisting
Function expression can get hosisted to the very top, function declaration's function name can, but the function itself can not
-
Function expression can get hosisted to the very top, function declaration's function name can, but the function itself can not
-
-
-
Cheating with Evel
-
cheating with "with", this is not allowed when "strict" mode is on.
-
-
Dynamic Scope: Check the call stack, it happens during run time
"this"
-
-
explicit binding: .f.call(obj) .f.apply(obj, [])
-
hard binding: fn.bind(fn, obj)
-
-
OO
-
-
-
-
method shadowing: create a same name method down to the prototype chain, it will be called instead of the one from parent
explicit polymorphism
-
if the name is different, we can delegate the method call to it and call the parent method from the prototype chain.
-
-
prototype = {} is evil, it throws away things
-
Intro
Async Patterns
callbacks
Uncertainty of Callback sequence and return values by giving control to someone else-> Callback hell
-
generators
solution: generator (es6) yield null, next()
-
-
-
-
-
-
-
-
-
Closure
-
Closure is when a fucntion "remembers" its lexical scope even when the function is executed outside that lexical scope.
-
-
-
-
-
var foo = function bar(){} function name bar is only with its own scope. It can be referenced in side of the function. :check:
-
-