const { log } = console;
// โญ๏ธ var hoisting
// ----------------
// โข identifier: IS hoistedโ
// โข value : initialized to `undefined`โ
log(greeting, typeof greeting); // undefined, 'undefined'
// โญ๏ธ identifier `greeting`:
// โข can be referenced nowโ (not a compile-time ReferenceError)
// โข but can't be called (not a "function") yetโ(runtime โ TypeError)
greeting(); // โ TypeError: 'greeting' is not a function
// โญ๏ธ the following is a "var declaration"
// โญ๏ธ "var declaration" is related to "var hoisting"
// ------------------------------------------------------
// โข identifier: hoisted to top of scopeโ
// โข value : initialized to `undefined`โ
// ------------------------------------------------------
// โญ๏ธ "var declaration"
//
// โญโ id โโฎ โญโโ value โโโฎ (`value` is a function expression)
var greeting = function() {
console.log("Hello!");
};