Skip to content

Instantly share code, notes, and snippets.

@scr2em
Last active August 9, 2023 12:37
Show Gist options
  • Save scr2em/f1feeca998754f61e596a63cc3a6ff22 to your computer and use it in GitHub Desktop.
Save scr2em/f1feeca998754f61e596a63cc3a6ff22 to your computer and use it in GitHub Desktop.
JS Lab 3 - ASAT 2023
console.log(a); // ?
var a = 5;
// ---------------------------------------
console.log(typeof c); // ?
var c = 'hoist me';
// ---------------------------------------
console.log(d); // ?
function foo() {
var d = 10;
console.log(d); // ?
}
// ---------------------------------------
console.log(e); // ?
var e = 5;
function e() {}
// ---------------------------------------
function hoistTest() {
console.log(g); // ?
var g = 'inner variable';
}
hoistTest();
// ---------------------------------------
function outer() {
function inner() {
console.log(l); // ?
}
var l = 'outer var';
inner();
}
outer();
// ---------------------------------------
function foo() {
function bar() {
return 3;
}
return bar();
function bar() {
return 8;
}
}
console.log(foo()); // ?
// ---------------------------------------
function parent() {
var hoisted = "I'm a variable";
function hoisted() {
return "I'm a function";
}
return hoisted();
}
console.log(parent()); // ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment