❗function hoisting first❗️
function hoisting has "higher" priority over variable hoisting.
JS ⟩ scope ⟩ hoisting ⟩ function hoisting ⟩ first
const { log } = console;
// <---- greeting === a "function" (at first)
// ⭐️ var hoisting has "lower" priority
var greeting; // ignored❗ (function hoisting first)
// ⭐️ function hoisting has "higher" priority
function greeting() {
console.log("Hello!");
}
log(typeof greeting); // at first, it's a "function"
// ⭐️ redeclaration ignored,
// ❗ but assignment applied.
var greeting = "Hello!"; // now greeting is a string❗
log(greeting, typeof greeting); // 'Hello!', "string"❗