Coding Style

If (condition) {
  // do this
  // ...and that
  // ...and that
}
  • Our code must be as clean and easy to read as possible.
  • N most JavaScript projects curly braces are written in "Egyptian" style with the opening brace on the same line as the corresponding keyword -- not on a new line. There should also be a space before the opening bracket.
  • The maximum line length should be agreed upon at the team-level. It's usually 80 or 120 characters.
  • There are two types of indents: Horizontal indents: 2 or 4 spaces.

Related concepts

Coding Style — Structure map

Clickable & Draggable!

Coding Style — Related pages: