Semicolons

Semicolons

  • 21.1 Yup. eslint: semi jscs: requireSemicolons

    // bad
    (function () {
      const name = 'Skywalker'
      return name
    })()
    
    // good
    (function () {
      const name = 'Skywalker';
      return name;
    }());
    
    // good, but legacy (guards against the function becoming an argument when two files with IIFEs are concatenated)
    ;((() => {
      const name = 'Skywalker';
      return name;
    })());
    

    Read more.

⬆ Back to Table of Contents