Skip to content

Instantly share code, notes, and snippets.

@chadfurman
Created January 31, 2017 13:44
Show Gist options
  • Save chadfurman/5a1d69cd752735faef025d4c8a2756e1 to your computer and use it in GitHub Desktop.
Save chadfurman/5a1d69cd752735faef025d4c8a2756e1 to your computer and use it in GitHub Desktop.
Meeting Notes 4

Meeting notes

  • Module pattern is very common. Old way of wrapping with a function, new way of export/import
  • Module pattern is something many frameworks have been using for a long time.
  • A really useful pattern since in JS we don't have access modifiers
  • What about module ___ from 'module' ? I think it's actually import * as module from 'module'
  • What about multiple exports in a single file? I think this is legal
  • this keyword -- the four rules.
    • new keyword
    • explicit
    • implicit
    • default
  • let vs var -- let defines a new copy of the var inside a for-loop, solving the issue of setTimeout all using same var
  • Hoisting is something we were doing as a matter of principal to keep our code-base clean -- we didn't know about the consequences of not
  • Exercises were very useful to show what was going on -- function declarations over expressions
  • Returning a function from an iife is a handy way of running it at the end
  • reviewing the new keyword and the things that occur there, how it makes a function into a constructor call
    • An empty object is created
    • The empty object gets linked to a different object
    • empty object gets bound as this for the purpose of the function call
    • if the function does not otherwise return anything, new will insert return this
  • Closures -- a function that remembers its scope even when its executed somewhere else
    • happens when an outer function returns an inner function
  • Closures -- we all use them, but understanding them in a bit more detail allows us to write higher quality code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment