Last active
August 29, 2015 14:17
-
-
Save cgrinaldi/238f33685b64acd36ab5 to your computer and use it in GitHub Desktop.
Simple function examples showing function expressions vs. function declarations
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
// simple example of a function declaration | |
function double (number) { | |
var result = 2 * number; | |
return result; | |
} |
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
// simple example of a function expression | |
var double = function (number) { | |
var result = 2 * number; | |
return result; | |
}; // don't forget to add a semicolon! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment