so we know that variables declared with the var keyword are hoisted and if we try to access their value before they have been initialized we get undefined. However, In the code below logging the name variable logs the function and not undefined why ?
console.log(name);
console.log(lol);
var name = function(args = "Hello World"){
console.log(args)
}
var lol = function(args = "Hello world") {
console.log(args)
}
the output is
function(args = "Hello World"){
console.log(args)
}
and
main.js:57 undefined
why isnt name variable undefined ?