Execute the following code:
function foo1()
{
return {
bar: "hello"
};
}
function foo2()
{
return
{
bar: "hello"
};
}
console.log(foo1());
console.log(foo2());
The result is shocking, foo2 actually returns undfined, the reason is that there is no code after return, which is equivalent to return;