New course! Every coder should learn Generative AI!
Try a free lesson+ 4
I believe this is the reason:
The function does not return anything, yet you are printing it. Hence, undefined.
Perhaps try doing the following:
var f= function(){
console.log("hello");
return "World!";
};