I am asking this because in AngularJS, we can do
$routeProvider
.when("/", {
    templateUrl: "pages/main.html",
    controller: "mainController"        
})
.when("/second", {
    templateUrl: "pages/second.html",
    controller: "secondController"            
})
and similarly, we can do
bar = {
    value: 123,
    print: function() {
        console.log(this.value)
    }
}
bar
.print()
and it will be invoked as bar.print()  But on the other hand, the following:
function foo() {
    return
    {
      a: 123
    }
}
console.log(foo())
will have a subtle error of JavaScript interpreter inserting a semicolon after the return, and therefore treating it as
return;      // <-- returning nothing, which means undefined
{
    a: 123
}
and one more case is:
a = 3
+4
console.log(a)
a = 3;
+4
console.log(a)
The first a will actually take it as 3 + 4, while the second case of a, it can take the +4 as a statement that evaluates to 4 and do nothing.
Why will a semicolon be inserted this way, while at the beginning of this question, that code has 2, 3, or more blank lines, but the . can still connect back to the object?  What rule is governing this?
Sample at:
https://jsfiddle.net/g1gsnmfr/5/
