A javascript free you do without semicolon but it puts a automatic semicolon, that is why you get undefined Refer this
function foo1()
{
return {
bar: "hello"
};
}
function foo2()
{
return{
bar: "hello"
};
}
console.log("foo1 returns:");
console.log(foo1());
console.log("foo2 returns:");
console.log(foo2());