Unable to deduce the code execution
I've been doing some JS lately and below is the code that i got from a friend , now I thought that both of console logs will return the hello, but it wont, it returns a console log as object and for second console it returns undefined. Can anyone please care to explain why is this happening
function hello1(){
return {
bar : "hello"
};
}
function hello2(){
return
{
bar : "hello"
};
}
console.log(hello1());
console.log(hello2());
and the result was
{bar: "hello"}
undefined