function declaration javascript hoisting code example
Example 1: function hoisting in js
console.log(functionBelow("Hello"));
function functionBelow(greet) {
return `${greet} world`;
}
console.log(functionBelow("Hi"));
Example 2: function hoisting in js
console.log(functionBelow("Hello"));
var functionBelow = function(greet) {
return `${greet} world`;
}
console.log(functionBelow("Hi"));