Excluding the standard reason return; .
Brackets in new BAD HABBITS lines taken from other C-shaped lagoons where this is standard. If readability is the reason, then we can also provide this variable name written in your own laguange, but we do not, right? The new ARE BAD HABBITS linear brackets, as well as, for example, in google chrome, are displayed as debbuger errors.
When you work with commands, there is a 99% chance that a new line { will be disabled due to IDEs that automatically save the code. Like WebStorm / VisualStudio.
When you look at github, you will see that the most popular is { on the same line. (If you find another version, provide an example)
In addition, each line of code should have a value in laguanges, which are mostly interpreted as uncompiled. How would you “explain” to intrereter a line that starts with:
{
? is this the beginning of the block? I think you said yes . Now tell me how much you can say about:
function foo() {
(of course, we are talking about non-minified files, for which we also save little memory)
I do not like to make inteprer look forward / backward. He should read the line and do what is in the line not in two lines.
I am sure that ECMA 202X will add it as a STANDARD. I don’t care, someone does this in their projects, but as a person who works mainly with TEAMS programmers, I would not accept this hipsterizing code.
The following case will be added, like CoffeScript / TypeScript and other dialects. These tools will return you code with { with the same line. What for? Try how it should be done.
EDIT:
I delved into my research about this and I contacted the ECMA team.
Hello, I am sure that I will probably not be responsible for this. But I would like to know what the ECMA team prefers. What curly braces in javascript will be written on one line or in a new line? (except for the example with the condition “return;” and an automatic semicolon. I am writing my dissertation and your message will be as useful as some professional POINT OF VIEW. Thanks for the great work.
as Answere I get this:
TC39 does not accept any formal provisions on stylist issues such as this. I am sure that among the member delegates participating in TC39 you will find various code formatting options. However, I suspect that most prefer to use explicit semicolons rather than relying on ASI .
edit: I know that some people are disappointed with the fact that they are doing something wrong, but giving "-1" is not the best approach. The comments section is open, so share your opinion with others.