Hyper Open Edge Cloud

Guideline Use Two Space Indentation

Consistent code indentation across languages.
  • Last Update:2017-04-05
  • Version:001
  • Language:en

Use Two Space Indentation

Tabs and 2-space indentation are being used equally. Since a lot of errors on JSLint often result from mixed use of space and tab using 2 spaces throughout prevents these errors up front.

Good Example:

function outer(a, b) {
  var c = 1,
    d = 2,
    inner;
  if (a > b) {
    inner = function () {
      return {
        "r": c - d
      };
    };
  } else {
    inner = function () {
      return {
        "r": c + d
      };
    };
  }
  return inner;
}

Bad Example:

function outer(a, b) {
  var c = 1,
  d = 2,
  inner;
  
  if (a > b) {
  inner = function () {
  return {
  "r": c - d
  }}}
};