4.2.1 Array literals: optionally block-like

    Any array literal may optionally be formatted as if it were a “block-likeconstruct.” For example, the following are all valid (not an exhaustivelist):

    1. someMethod(foo, [
    2. 0, 1, 2,
    3. ], bar);

    Other combinations are allowed, particularly when emphasizing semantic groupingsbetween elements, but should not be used only to reduce the vertical size oflarger arrays.

    4.2.2 Object literals: optionally block-like

    Any object literal may optionally be formatted as if it were a “block-likeconstruct.” The same examples apply as . Forexample, the following are all valid (not an exhaustive list):

    1. const c = {a: 0, b: 1};
    2. a: 0, b: 1,
    3. }, bar);

    4.2.3 Class literals

    Example:

    1. foo.Bar = class extends Foo {
    2. /** @override */
    3. method() {
    4. return super.method() / 2;
    5. }
    6. };
    7. /** @interface */
    8. class Frobnicator {
    9. frobnicate(message) {}

    4.2.4 Function expressions

    When declaring an anonymous function in the list of arguments for a functioncall, the body of the function is indented two spaces more than the precedingindentation depth.

    Example:

    4.2.5 Switch statements

    After a switch label, a newline appears, and the indentation level is increased+2, exactly as if a block were being opened. An explicit block may be used ifrequired by lexical scoping. The following switch label returns to the previousindentation level, as if a block had been closed.

    A blank line is optional between a break and the following case.

    Example:

    1. switch (animal) {
    2. case Animal.BANDERSNATCH:
    3. handleBandersnatch();
    4. break;
    5. case Animal.JABBERWOCK:
    6. handleJabberwock();
    7. break;
    8. default:
    9. }