I have 2 JavaScript functions that return the same object, upon calling both functions one after another, why does the 2nd function return undefined
?
function foo1()
{
return {
bar: "hello"
};
}
function foo2()
{
return
{
bar: "hello"
};
}
console.log(foo1());
console.log(foo2());
// foo1 returns:
// Object {bar: "hello"}
// foo2 returns:
// undefined