Skip to content

Instantly share code, notes, and snippets.

@b-tekinli
Created May 26, 2024 15:46
Show Gist options
  • Save b-tekinli/55000a4d0afce8bcf41326ccd5aab842 to your computer and use it in GitHub Desktop.
Save b-tekinli/55000a4d0afce8bcf41326ccd5aab842 to your computer and use it in GitHub Desktop.
js interview outer inner scope
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