(function(){
function sayHello(){
var name = "Hi John";
return
{
fullName: name
}
}
console.log(sayHello().fullName);
})();
The console will output
Uncaught TypeError: Cannot read property 'fullName' of undefined
I read this question from an interview exercise book,and I cannot understand the reason behind this, anyone could help me?