Created
October 4, 2013 08:05
-
-
Save dannycallaghan/6822543 to your computer and use it in GitHub Desktop.
JavaScript Function Terminology
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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