Depends on the language. In JS most teams choose opening brace on the same line.
Crockford gives an argument for why: ASI (automatic semicolon insertion) can in at least one case break your code if you put the opening brace on a new line.
The example is returning an object. This works:
return {
foo: "bar"
};
This breaks:
return
{
foo: "bar"
};
...because ASI means the interpreter decides this means:
return;
{
foo: "bar"
};
So instead of an object you get undefined. Curses!
Now you could say that you'll just memorise this rule, use braces on new lines except when returning an object. But as Crockford points out if you have a choice between two ways to do something, one never breaks and one sometimes breaks... why pick the one that sometimes breaks?
And many people, not just Crockford, have pointed out - why pick the method that means everyone on the team has to remember 100% of the time exactly when to use the alternative format?
So in JavaScript at least, opening brace on the same line is generally preferred/idiomatic.