https://bigfrontend.dev/quiz/Hoisting-II
What does the code snippet below output by console.log
?
const func1 = () => console.log(1);
func1();
func2();
function func2() {
console.log(2);
}
func3();
var func3 = function func4() {
console.log(3);
};
const func1 = () => console.log(1);
func1(); // 1
func2(); // 2
function func2() {
console.log(2);
}
func3(); // Error. Function expressions are not hoisted.
var func3 = function func4() {
console.log(3);
};