Skip to content

Files

Latest commit

8396bad · Sep 19, 2017

History

History
52 lines (40 loc) · 607 Bytes

File metadata and controls

52 lines (40 loc) · 607 Bytes


Blocks

  • 16.1 Use braces with all multi-line blocks.
// bad
if (test)
  return false;

// good
if (test) return false;

// good
if (test) {
  return false;
}

// bad
function() { return false; }

// good
function() {
  return false;
}
  • 16.2 If you're using multi-line blocks with if and else, put else on the same line as your if block's closing brace.
// bad
if (test) {
  thing1();
  thing2();
}
else {
  thing3();
}

// good
if (test) {
  thing1();
  thing2();
} else {
  thing3();
}