Created
October 21, 2020 14:54
-
-
Save camilomontoyau/acee99a580ed5ba97b2d98da4c4926b3 to your computer and use it in GitHub Desktop.
javascript scope
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
const a = 1; | |
const b = 2; | |
const c = 3; | |
(function firstFunction() { | |
const b = 5; | |
const c = 6; | |
(function secondFunction() { | |
const b = 8; | |
(function thirdFunction() { | |
const a = 7; | |
const c = 9; | |
(function fourthFunction() { | |
const a = 1; | |
const c = 8; | |
})(); | |
})(); | |
})(); | |
})(); | |
console.log(`a: ${a}, b: ${b}, c: ${c}`); | |
// wanted output a: 1, b: 8, c: 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment