Created
May 15, 2021 18:09
-
-
Save helabenkhalfallah/cf825b9ab1ffbad4c63a39573078c5ba to your computer and use it in GitHub Desktop.
JS Function Scole
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
const run = () => { | |
// "run" function scope | |
const two = 2; | |
let count = 0; | |
const run2 = () => { } | |
console.log(two); // 2 | |
console.log(count); // 0 | |
console.log(run2); // function | |
} | |
run(); | |
console.log(two); // throws ReferenceError | |
console.log(count); // throws ReferenceError | |
console.log(run2); // throws ReferenceError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment