Skip to content

Instantly share code, notes, and snippets.

@jlcarrascof
Created January 31, 2025 21:31
Show Gist options
  • Save jlcarrascof/351520e757ca51f66ffbeacfeb4d285d to your computer and use it in GitHub Desktop.
Save jlcarrascof/351520e757ca51f66ffbeacfeb4d285d to your computer and use it in GitHub Desktop.
Hoisting Example.
console.log(a); // What value does 'a' have here?
var a = 5;
console.log(b); // What value does 'b' have here?
let b = 10;
function example() {
console.log(c); // What value does 'c' have here?
var c = 15;
console.log(d); // What value does 'd' have here?
let d = 20;
if (true) {
console.log(e); // What value does 'e' have here?
var e = 25;
console.log(f); // What value does 'f' have here?
let f = 30;
}
console.log(e); // What value does 'e' have here?
console.log(f); // What value does 'f' have here?
}
example();
console.log(a); // What value does 'a' have here?
console.log(b); // What value does 'b' have here?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment