I remember there is a convention/recommendation to put opening brace in the same line, because of the way JavaScript adds a semicolon or something.
//OK
fun
The JavaScript Garden has a chapter about automatic semicolon insertion. It gives good examples when semicolons are added automatically:
JavaScript is not a semicolon-less language, it in fact needs the semicolons in order to understand the source code. Therefore the JavaScript parser automatically inserts them whenever it encounters a parse error due to a missing semicolon.
In your example JavaScript wouldn't encounter an error due to a missing semicolon though.