Brace styles and JavaScript
In languages whose syntax is derived from C (e.g.: C ← C++ ← Java ← JavaScript), two brace styles are most common: Allman style and 1TBS. Allman style If a statement [1] contains a block, that block is considered as somewhat separate from the header of the statement: its opening brace is in a line of its own, at the same indentation level as the head. For example: function foo(x, y, z) { if (x) { a(); } else { b(); c(); } } 1TBS (One True Brace Style) Here, a block is more closely associated with the header of its statement, it starts after it, in the same line. For example: function foo(x, y, z) { if (x) { a(); } else { b(); c(); } } 1TBS is a variant of the (older) K&R (Kernighan and Ritchie) style. In K&R style, functions are written in Allman style and braces are omitted where they are not necessary, e.g. around single-stateme...