Last active
January 18, 2018 18:19
-
-
Save jdberrocal1/f54a1076ba97e30c9014d7ac20f00ed3 to your computer and use it in GitHub Desktop.
JavaScript Function Definitions
This file contains hidden or 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
| 1. Named Function Declaration: | |
| function test () { | |
| // code | |
| } | |
| 2. Anonymous Function Declaration (Usually callbacks) | |
| array.forEach(function (item){}) | |
| 3. Named Function Expression | |
| var x = function test (a, b) {return a * b}; | |
| 4. Anonymous Function Expression | |
| var x = function (a, b) {return a * b}; | |
| 5. Immediately Invoked Function Expression (IIFE) | |
| (function () { | |
| var x = "Hello!!"; | |
| })(); | |
| 6. Arrow Functions (ES6) | |
| array.forEach(item => {}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment