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
lethijacks block-scope -- differences betweenletandvaris "block scope" and "hoisting"letis 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-eris cool, but try/catch work-around is lame.letis cool, but must be used with caution- Does
letactually increase performance?letmight be a bit more performant, due to stricter scope and better garbage collecting - Mozilla suggests "use
let" with transpilers, even thoughletisn'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
evalis useful for dynamic variable names.evalat run-time polutes local scope. Instrictmode, eval gets its own scope.withis 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
windowinto IIFE and calling it global is neat. - Nice to have a name for IIFE!
- People put
undefinedin function arguments to make sureundefinedis undefined. In non-strict mode, someone can doundefined = trueor 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.