Skip to content

Instantly share code, notes, and snippets.

@zekewell
Forked from anonymous/index.html
Created September 26, 2015 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zekewell/c8add270eaee3c1a917a to your computer and use it in GitHub Desktop.
Save zekewell/c8add270eaee3c1a917a to your computer and use it in GitHub Desktop.
FunctionsFunctions: programs within programs// source http://jsbin.com/halezo
/*
The two phases to using functions: First we must ___? Next we can execute (or two other words for executing a function?) a function by?
What’s the difference between a function’s parameters and arguments PASSED to a function?
What’s the syntax for a NAMED function?
How do we assign a function to a variable?
Functions can OPTIONALLY take inputs and OPTIONALLY return a single value, how do we specify inputs, and how do we return a value?
NOTE: Primitive (simple) values are passed to a function BY COPY, complex by reference. Try it!
Scope: Functions can see and modify variables in parent or global scopes. The inverse is NOT true.
Closures: Functions form closures around the data they house. If an object returned from the Function and is held in memory somewhere (referenced), that closure stays ALIVE, and data can continue to exist in these closures! (See: our meeting-room app for an example!) (ALSO, see: Understanding JavaScript Closures with Ease)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment