Created
May 26, 2024 15:46
-
-
Save b-tekinli/55000a4d0afce8bcf41326ccd5aab842 to your computer and use it in GitHub Desktop.
js interview outer inner 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
var globalVar = "ben global scope"; // Global scope | |
function outerFunction() { | |
var outerVar = "ben outer function scope"; // Outer function scope | |
function innerFunction() { | |
var innerVar = "ben inner function scope"; // Inner function scope | |
console.log(globalVar); // Erişilebilir | |
console.log(outerVar); // Erişilebilir | |
console.log(innerVar); // Erişilebilir | |
} | |
innerFunction(); | |
console.log(innerVar); // Erişilemez, hata verir | |
} | |
outerFunction(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment