Is anyone able to explain why this code is printing function
when I expect it to print undefined
? I am just starting out with JavaScript.
function createGreeter(greeting){
function greet(){
console.log(greeting,name)
}
return greet
}
let g1=createGreeter('Good Morning')
console.log(typeof g1)
let g2=createGreeter('Good Evening')