Skip to content

Instantly share code, notes, and snippets.

@dannycallaghan
Created October 4, 2013 08:05
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 dannycallaghan/6822543 to your computer and use it in GitHub Desktop.
Save dannycallaghan/6822543 to your computer and use it in GitHub Desktop.
JavaScript Function Terminology
/* Function Terminology */
// - (unamed) function expression
// - anonymous function
// - a.k.a. function literal
var add = function ( a, b ) {
return a + b;
};
// - (unamed) function expression
// - anonymous function
callMe( function () {
// do something
} );
// - (named) function expression
// - a.k.a. function literal
var add = function add ( a, b ) {
return a + b;
};
// - (named) function expression
// - named function expression
callMe( function maybe () {
// do something
} );
// - function declaration
// can only appear in "program code" meaning inside other functions or in global space
function add ( a, b ) {
return a + b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment