Please enable JavaScript.
Coggle requires JavaScript to display documents.
Javascript - Coggle Diagram
Javascript
Objects (Obj)
Variables don't hold Obj, they hold a reference to an Obj, a pointer.
-
When you call a Fn and pass it an Obj, you're passing the Obj reference, not the Obj itself.
-
-
the new keyword
The purpose of the new keyword is to invoke a function with a this keyword pointing at a whole new empty Object
-
Hoisting
If you use a Var w/o declaring it first, it becomes global
-
-
-
JS doesn't actually hoist, in really Lexical Scoping is what happens
-
var hoists to a Fn
when var hoists : at the start of the scope, initialize var to undefined
Closure
-
it's when when a Fn is able to "remember" and access its lexical scope even when the function is executed outside that lexical scope.
JS engines implement closure as a linkage to the entire scope, not on a per variable basis
-
-
-
-
-
-
Functions (Fn)
function bark ( name, weight )
-
parameters (name, weight)
-
-
-
-
IIFE Pattern
-
-
think of prepaid phones from the wire, IIFE FN are one and done
-
Module Pattern
The idea of a module is that there are things that are public, and things that are private (nobody outside can touch).
-
Modules encapsulate data and behaviour (methods) together. The state (data) of a module is held by its methods via closure.
-
-