Can someone assist me - why we have this behavior in JS snippet?
var foo = function() {
return {
hi: console.log("foo")
}
}
var foo1 = function() {
return
{
hi: console.log("foo1")
}
}
foo();
foo1();
Why only "foo" is printed?
EDIT ok, this is because of automatic semi-colon insertion, BUT
do we have some ways to force JS to not execute this cases?
I mean, can we do something that will throw error here?
EDIT2
Looks like best suggestion is JShint - i asked here