Created
February 25, 2019 23:14
-
-
Save joshuaaguilar20/79ebe3a3f1c95277752e9dd1cbba35a1 to your computer and use it in GitHub Desktop.
Function Expressions
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
"use strict"; | |
`` | |
var a = 2; | |
(function foo(){ // <-- insert this | |
var a = 3; | |
console.log( a ); // 3 | |
})(); // <-- and this | |
console.log( a ); // 2 | |
var a = 2; | |
(function foo(){ // <-- insert this | |
var a = 3; | |
console.log( a ); // 3 | |
})(); // <-- and this | |
console.log( a ); // 2 | |
(function test(){ | |
a = 10 | |
console.log(a) | |
})() | |
(function IIFE(secondFunction){ | |
secondFunction('some global' ) | |
})(function secondFunction(global){ | |
var a = 3; | |
console.log(a); | |
console.log(global) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment