Meeting Notes:
- Discussed reviewing meeting notes at the end -- divide and conqueror? Putting together a nice writeup for each day?
- Talked about note writing techniques
let
hijacks block-scope -- differences betweenlet
andvar
is "block scope" and "hoisting"let
is cool, has some advantages, but is it really useful? Garbage collector? Security? "Hoisting" is important!let
-blocks are cool. Too bad they're not actually in JS.let-er
is cool, but try/catch work-around is lame.let
is cool, but must be used with caution- Does
let
actually increase performance?let
might be a bit more performant, due to stricter scope and better garbage collecting - Mozilla suggests "use
let
" with transpilers, even thoughlet
isn't supported yet. let
"is" hoisted? Just hoisted with a different value -- "undeclared" rather than the value you give it.- We like putting our variables at the top, so "hoisting" isn't that important.
- Discussion of the eval statement -- if you use it, compiler doesn't optimize, your code will run slower
- "Lexical" vs "Dyanmic" scope -- Lexical is at compile-time. Evail can trigger runtime-scope and drop var declarations at runtime
eval
is useful for dynamic variable names.eval
at run-time polutes local scope. Instrict
mode, eval gets its own scope.with
is an interesting keyword and we've generally skipped it. Same witheval
-- they're both "evil"- setTimeout has a string version!? It also works like eval!
- IIFE Pattern -- we've seen it before, but patterns are cool! Passing
window
into IIFE and calling it global is neat. - Nice to have a name for IIFE!
- People put
undefined
in function arguments to make sureundefined
is undefined. In non-strict mode, someone can doundefined = true
or some-such. - Name your functions! Don't use anonymous functions, they don't play well with a debugger. Even in a function expression, name them.