Skip to content

Instantly share code, notes, and snippets.

Created September 26, 2015 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/5d43ca299b5a2a7e60b8 to your computer and use it in GitHub Desktop.
Save anonymous/5d43ca299b5a2a7e60b8 to your computer and use it in GitHub Desktop.
Functions Functions: programs within programs // source http://jsbin.com/halezo
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Functions: programs within programs">
<meta charset="utf-8">
<title>Functions</title>
</head>
<body>
<script id="jsbin-javascript">
/*
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)
*/
</script>
<script id="jsbin-source-javascript" type="text/javascript">/*
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)
*/
</script></body>
</html>
/*
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