{"id":20127368,"url":"https://github.com/mrhrifat/javascript","last_synced_at":"2025-09-21T04:32:02.836Z","repository":{"id":53028757,"uuid":"353829864","full_name":"mrhrifat/javascript","owner":"mrhrifat","description":"JavaScript is the most popular Programming language in the world. Over 97% of websites use JavaScript on the client side for web page behavior, often incorporating third-party libraries.","archived":false,"fork":false,"pushed_at":"2022-11-28T14:17:26.000Z","size":365,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-05T07:25:54.401Z","etag":null,"topics":["array","code","condition","function","functional-programming","javascript","javascript-concepts","javascript-vanilla","js","loop","object","operator","programming","vanila-javascript"],"latest_commit_sha":null,"homepage":"https://github.com/mrhrifat/javascript","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrhrifat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-01T21:22:29.000Z","updated_at":"2022-12-14T23:38:20.000Z","dependencies_parsed_at":"2023-01-22T16:45:19.511Z","dependency_job_id":null,"html_url":"https://github.com/mrhrifat/javascript","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhrifat%2Fjavascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhrifat%2Fjavascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhrifat%2Fjavascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrhrifat%2Fjavascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrhrifat","download_url":"https://codeload.github.com/mrhrifat/javascript/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224518605,"owners_count":17324635,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array","code","condition","function","functional-programming","javascript","javascript-concepts","javascript-vanilla","js","loop","object","operator","programming","vanila-javascript"],"created_at":"2024-11-13T20:20:47.504Z","updated_at":"2025-09-21T04:32:02.457Z","avatar_url":"https://github.com/mrhrifat.png","language":"JavaScript","readme":"# Airbnb JavaScript Style Guide() {\n\n*A mostly reasonable approach to JavaScript*\n\n\u003e **Note**: this guide assumes you are using [Babel](https://babeljs.io), and requires that you use [babel-preset-airbnb](https://npmjs.com/babel-preset-airbnb) or the equivalent. It also assumes you are installing shims/polyfills in your app, with [airbnb-browser-shims](https://npmjs.com/airbnb-browser-shims) or the equivalent.\n\n[![Downloads](https://img.shields.io/npm/dm/eslint-config-airbnb.svg)](https://www.npmjs.com/package/eslint-config-airbnb)\n[![Downloads](https://img.shields.io/npm/dm/eslint-config-airbnb-base.svg)](https://www.npmjs.com/package/eslint-config-airbnb-base)\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/airbnb/javascript?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n\nThis guide is available in other languages too. See [Translation](#translation)\n\nOther Style Guides\n\n  - [ES5 (Deprecated)](https://github.com/airbnb/javascript/tree/es5-deprecated/es5)\n  - [React](react/)\n  - [CSS-in-JavaScript](css-in-javascript/)\n  - [CSS \u0026 Sass](https://github.com/airbnb/css)\n  - [Ruby](https://github.com/airbnb/ruby)\n\n## Table of Contents\n\n  1. [Types](#types)\n  1. [References](#references)\n  1. [Objects](#objects)\n  1. [Arrays](#arrays)\n  1. [Destructuring](#destructuring)\n  1. [Strings](#strings)\n  1. [Functions](#functions)\n  1. [Arrow Functions](#arrow-functions)\n  1. [Classes \u0026 Constructors](#classes--constructors)\n  1. [Modules](#modules)\n  1. [Iterators and Generators](#iterators-and-generators)\n  1. [Properties](#properties)\n  1. [Variables](#variables)\n  1. [Hoisting](#hoisting)\n  1. [Comparison Operators \u0026 Equality](#comparison-operators--equality)\n  1. [Blocks](#blocks)\n  1. [Control Statements](#control-statements)\n  1. [Comments](#comments)\n  1. [Whitespace](#whitespace)\n  1. [Commas](#commas)\n  1. [Semicolons](#semicolons)\n  1. [Type Casting \u0026 Coercion](#type-casting--coercion)\n  1. [Naming Conventions](#naming-conventions)\n  1. [Accessors](#accessors)\n  1. [Events](#events)\n  1. [jQuery](#jquery)\n  1. [ECMAScript 5 Compatibility](#ecmascript-5-compatibility)\n  1. [ECMAScript 6+ (ES 2015+) Styles](#ecmascript-6-es-2015-styles)\n  1. [Standard Library](#standard-library)\n  1. [Testing](#testing)\n  1. [Performance](#performance)\n  1. [Resources](#resources)\n  1. [In the Wild](#in-the-wild)\n  1. [Translation](#translation)\n  1. [The JavaScript Style Guide Guide](#the-javascript-style-guide-guide)\n  1. [Chat With Us About JavaScript](#chat-with-us-about-javascript)\n  1. [Contributors](#contributors)\n  1. [License](#license)\n  1. [Amendments](#amendments)\n\n## Types\n\n  \u003ca name=\"types--primitives\"\u003e\u003c/a\u003e\u003ca name=\"1.1\"\u003e\u003c/a\u003e\n  - [1.1](#types--primitives) **Primitives**: When you access a primitive type you work directly on its value.\n\n    - `string`\n    - `number`\n    - `boolean`\n    - `null`\n    - `undefined`\n    - `symbol`\n    - `bigint`\n\n    \u003cbr /\u003e\n\n    ```javascript\n    const foo = 1;\n    let bar = foo;\n\n    bar = 9;\n\n    console.log(foo, bar); // =\u003e 1, 9\n    ```\n\n    - Symbols and BigInts cannot be faithfully polyfilled, so they should not be used when targeting browsers/environments that don’t support them natively.\n\n  \u003ca name=\"types--complex\"\u003e\u003c/a\u003e\u003ca name=\"1.2\"\u003e\u003c/a\u003e\n  - [1.2](#types--complex)  **Complex**: When you access a complex type you work on a reference to its value.\n\n    - `object`\n    - `array`\n    - `function`\n\n    \u003cbr /\u003e\n\n    ```javascript\n    const foo = [1, 2];\n    const bar = foo;\n\n    bar[0] = 9;\n\n    console.log(foo[0], bar[0]); // =\u003e 9, 9\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## References\n\n  \u003ca name=\"references--prefer-const\"\u003e\u003c/a\u003e\u003ca name=\"2.1\"\u003e\u003c/a\u003e\n  - [2.1](#references--prefer-const) Use `const` for all of your references; avoid using `var`. eslint: [`prefer-const`](https://eslint.org/docs/rules/prefer-const), [`no-const-assign`](https://eslint.org/docs/rules/no-const-assign)\n\n    \u003e Why? This ensures that you can’t reassign your references, which can lead to bugs and difficult to comprehend code.\n\n    ```javascript\n    // bad\n    var a = 1;\n    var b = 2;\n\n    // good\n    const a = 1;\n    const b = 2;\n    ```\n\n  \u003ca name=\"references--disallow-var\"\u003e\u003c/a\u003e\u003ca name=\"2.2\"\u003e\u003c/a\u003e\n  - [2.2](#references--disallow-var) If you must reassign references, use `let` instead of `var`. eslint: [`no-var`](https://eslint.org/docs/rules/no-var)\n\n    \u003e Why? `let` is block-scoped rather than function-scoped like `var`.\n\n    ```javascript\n    // bad\n    var count = 1;\n    if (true) {\n      count += 1;\n    }\n\n    // good, use the let.\n    let count = 1;\n    if (true) {\n      count += 1;\n    }\n    ```\n\n  \u003ca name=\"references--block-scope\"\u003e\u003c/a\u003e\u003ca name=\"2.3\"\u003e\u003c/a\u003e\n  - [2.3](#references--block-scope) Note that both `let` and `const` are block-scoped, whereas `var` is function-scoped.\n\n    ```javascript\n    // const and let only exist in the blocks they are defined in.\n    {\n      let a = 1;\n      const b = 1;\n      var c = 1;\n    }\n    console.log(a); // ReferenceError\n    console.log(b); // ReferenceError\n    console.log(c); // Prints 1\n    ```\n\n    In the above code, you can see that referencing `a` and `b` will produce a ReferenceError, while `c` contains the number. This is because `a` and `b` are block scoped, while `c` is scoped to the containing function.\n\n**[⬆ back to top](#table-of-contents)**\n\n## Objects\n\n  \u003ca name=\"objects--no-new\"\u003e\u003c/a\u003e\u003ca name=\"3.1\"\u003e\u003c/a\u003e\n  - [3.1](#objects--no-new) Use the literal syntax for object creation. eslint: [`no-new-object`](https://eslint.org/docs/rules/no-new-object)\n\n    ```javascript\n    // bad\n    const item = new Object();\n\n    // good\n    const item = {};\n    ```\n\n  \u003ca name=\"es6-computed-properties\"\u003e\u003c/a\u003e\u003ca name=\"3.4\"\u003e\u003c/a\u003e\n  - [3.2](#es6-computed-properties) Use computed property names when creating objects with dynamic property names.\n\n    \u003e Why? They allow you to define all the properties of an object in one place.\n\n    ```javascript\n\n    function getKey(k) {\n      return `a key named ${k}`;\n    }\n\n    // bad\n    const obj = {\n      id: 5,\n      name: 'San Francisco',\n    };\n    obj[getKey('enabled')] = true;\n\n    // good\n    const obj = {\n      id: 5,\n      name: 'San Francisco',\n      [getKey('enabled')]: true,\n    };\n    ```\n\n  \u003ca name=\"es6-object-shorthand\"\u003e\u003c/a\u003e\u003ca name=\"3.5\"\u003e\u003c/a\u003e\n  - [3.3](#es6-object-shorthand) Use object method shorthand. eslint: [`object-shorthand`](https://eslint.org/docs/rules/object-shorthand)\n\n    ```javascript\n    // bad\n    const atom = {\n      value: 1,\n\n      addValue: function (value) {\n        return atom.value + value;\n      },\n    };\n\n    // good\n    const atom = {\n      value: 1,\n\n      addValue(value) {\n        return atom.value + value;\n      },\n    };\n    ```\n\n  \u003ca name=\"es6-object-concise\"\u003e\u003c/a\u003e\u003ca name=\"3.6\"\u003e\u003c/a\u003e\n  - [3.4](#es6-object-concise) Use property value shorthand. eslint: [`object-shorthand`](https://eslint.org/docs/rules/object-shorthand)\n\n    \u003e Why? It is shorter and descriptive.\n\n    ```javascript\n    const lukeSkywalker = 'Luke Skywalker';\n\n    // bad\n    const obj = {\n      lukeSkywalker: lukeSkywalker,\n    };\n\n    // good\n    const obj = {\n      lukeSkywalker,\n    };\n    ```\n\n  \u003ca name=\"objects--grouped-shorthand\"\u003e\u003c/a\u003e\u003ca name=\"3.7\"\u003e\u003c/a\u003e\n  - [3.5](#objects--grouped-shorthand) Group your shorthand properties at the beginning of your object declaration.\n\n    \u003e Why? It’s easier to tell which properties are using the shorthand.\n\n    ```javascript\n    const anakinSkywalker = 'Anakin Skywalker';\n    const lukeSkywalker = 'Luke Skywalker';\n\n    // bad\n    const obj = {\n      episodeOne: 1,\n      twoJediWalkIntoACantina: 2,\n      lukeSkywalker,\n      episodeThree: 3,\n      mayTheFourth: 4,\n      anakinSkywalker,\n    };\n\n    // good\n    const obj = {\n      lukeSkywalker,\n      anakinSkywalker,\n      episodeOne: 1,\n      twoJediWalkIntoACantina: 2,\n      episodeThree: 3,\n      mayTheFourth: 4,\n    };\n    ```\n\n  \u003ca name=\"objects--quoted-props\"\u003e\u003c/a\u003e\u003ca name=\"3.8\"\u003e\u003c/a\u003e\n  - [3.6](#objects--quoted-props) Only quote properties that are invalid identifiers. eslint: [`quote-props`](https://eslint.org/docs/rules/quote-props)\n\n    \u003e Why? In general we consider it subjectively easier to read. It improves syntax highlighting, and is also more easily optimized by many JS engines.\n\n    ```javascript\n    // bad\n    const bad = {\n      'foo': 3,\n      'bar': 4,\n      'data-blah': 5,\n    };\n\n    // good\n    const good = {\n      foo: 3,\n      bar: 4,\n      'data-blah': 5,\n    };\n    ```\n\n  \u003ca name=\"objects--prototype-builtins\"\u003e\u003c/a\u003e\n  - [3.7](#objects--prototype-builtins) Do not call `Object.prototype` methods directly, such as `hasOwnProperty`, `propertyIsEnumerable`, and `isPrototypeOf`. eslint: [`no-prototype-builtins`](https://eslint.org/docs/rules/no-prototype-builtins)\n\n    \u003e Why? These methods may be shadowed by properties on the object in question - consider `{ hasOwnProperty: false }` - or, the object may be a null object (`Object.create(null)`). In modern browsers that support ES2022, or with a polyfill such as \u003chttps://npmjs.com/object.hasown\u003e, `Object.hasOwn` can also be used as an alternative to `Object.prototype.hasOwnProperty.call`.\n\n    ```javascript\n    // bad\n    console.log(object.hasOwnProperty(key));\n\n    // good\n    console.log(Object.prototype.hasOwnProperty.call(object, key));\n\n    // better\n    const has = Object.prototype.hasOwnProperty; // cache the lookup once, in module scope.\n    console.log(has.call(object, key));\n\n    // best\n    console.log(Object.hasOwn(object, key)); // only supported in browsers that support ES2022\n\n    /* or */\n    import has from 'has'; // https://www.npmjs.com/package/has\n    console.log(has(object, key));\n    /* or */\n    console.log(Object.hasOwn(object, key)); // https://www.npmjs.com/package/object.hasown\n    ```\n\n  \u003ca name=\"objects--rest-spread\"\u003e\u003c/a\u003e\n  - [3.8](#objects--rest-spread) Prefer the object spread syntax over [`Object.assign`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) to shallow-copy objects. Use the object rest parameter syntax to get a new object with certain properties omitted. eslint: [`prefer-object-spread`](https://eslint.org/docs/rules/prefer-object-spread)\n\n    ```javascript\n    // very bad\n    const original = { a: 1, b: 2 };\n    const copy = Object.assign(original, { c: 3 }); // this mutates `original` ಠ_ಠ\n    delete copy.a; // so does this\n\n    // bad\n    const original = { a: 1, b: 2 };\n    const copy = Object.assign({}, original, { c: 3 }); // copy =\u003e { a: 1, b: 2, c: 3 }\n\n    // good\n    const original = { a: 1, b: 2 };\n    const copy = { ...original, c: 3 }; // copy =\u003e { a: 1, b: 2, c: 3 }\n\n    const { a, ...noA } = copy; // noA =\u003e { b: 2, c: 3 }\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Arrays\n\n  \u003ca name=\"arrays--literals\"\u003e\u003c/a\u003e\u003ca name=\"4.1\"\u003e\u003c/a\u003e\n  - [4.1](#arrays--literals) Use the literal syntax for array creation. eslint: [`no-array-constructor`](https://eslint.org/docs/rules/no-array-constructor)\n\n    ```javascript\n    // bad\n    const items = new Array();\n\n    // good\n    const items = [];\n    ```\n\n  \u003ca name=\"arrays--push\"\u003e\u003c/a\u003e\u003ca name=\"4.2\"\u003e\u003c/a\u003e\n  - [4.2](#arrays--push) Use [Array#push](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/push) instead of direct assignment to add items to an array.\n\n    ```javascript\n    const someStack = [];\n\n    // bad\n    someStack[someStack.length] = 'abracadabra';\n\n    // good\n    someStack.push('abracadabra');\n    ```\n\n  \u003ca name=\"es6-array-spreads\"\u003e\u003c/a\u003e\u003ca name=\"4.3\"\u003e\u003c/a\u003e\n  - [4.3](#es6-array-spreads) Use array spreads `...` to copy arrays.\n\n    ```javascript\n    // bad\n    const len = items.length;\n    const itemsCopy = [];\n    let i;\n\n    for (i = 0; i \u003c len; i += 1) {\n      itemsCopy[i] = items[i];\n    }\n\n    // good\n    const itemsCopy = [...items];\n    ```\n\n  \u003ca name=\"arrays--from\"\u003e\u003c/a\u003e\n  \u003ca name=\"arrays--from-iterable\"\u003e\u003c/a\u003e\u003ca name=\"4.4\"\u003e\u003c/a\u003e\n  - [4.4](#arrays--from-iterable) To convert an iterable object to an array, use spreads `...` instead of [`Array.from`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/from)\n\n    ```javascript\n    const foo = document.querySelectorAll('.foo');\n\n    // good\n    const nodes = Array.from(foo);\n\n    // best\n    const nodes = [...foo];\n    ```\n\n  \u003ca name=\"arrays--from-array-like\"\u003e\u003c/a\u003e\n  - [4.5](#arrays--from-array-like) Use [`Array.from`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/from) for converting an array-like object to an array.\n\n    ```javascript\n    const arrLike = { 0: 'foo', 1: 'bar', 2: 'baz', length: 3 };\n\n    // bad\n    const arr = Array.prototype.slice.call(arrLike);\n\n    // good\n    const arr = Array.from(arrLike);\n    ```\n\n  \u003ca name=\"arrays--mapping\"\u003e\u003c/a\u003e\n  - [4.6](#arrays--mapping) Use [`Array.from`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/from) instead of spread `...` for mapping over iterables, because it avoids creating an intermediate array.\n\n    ```javascript\n    // bad\n    const baz = [...foo].map(bar);\n\n    // good\n    const baz = Array.from(foo, bar);\n    ```\n\n  \u003ca name=\"arrays--callback-return\"\u003e\u003c/a\u003e\u003ca name=\"4.5\"\u003e\u003c/a\u003e\n  - [4.7](#arrays--callback-return) Use return statements in array method callbacks. It’s ok to omit the return if the function body consists of a single statement returning an expression without side effects, following [8.2](#arrows--implicit-return). eslint: [`array-callback-return`](https://eslint.org/docs/rules/array-callback-return)\n\n    ```javascript\n    // good\n    [1, 2, 3].map((x) =\u003e {\n      const y = x + 1;\n      return x * y;\n    });\n\n    // good\n    [1, 2, 3].map((x) =\u003e x + 1);\n\n    // bad - no returned value means `acc` becomes undefined after the first iteration\n    [[0, 1], [2, 3], [4, 5]].reduce((acc, item, index) =\u003e {\n      const flatten = acc.concat(item);\n    });\n\n    // good\n    [[0, 1], [2, 3], [4, 5]].reduce((acc, item, index) =\u003e {\n      const flatten = acc.concat(item);\n      return flatten;\n    });\n\n    // bad\n    inbox.filter((msg) =\u003e {\n      const { subject, author } = msg;\n      if (subject === 'Mockingbird') {\n        return author === 'Harper Lee';\n      } else {\n        return false;\n      }\n    });\n\n    // good\n    inbox.filter((msg) =\u003e {\n      const { subject, author } = msg;\n      if (subject === 'Mockingbird') {\n        return author === 'Harper Lee';\n      }\n\n      return false;\n    });\n    ```\n\n  \u003ca name=\"arrays--bracket-newline\"\u003e\u003c/a\u003e\n  - [4.8](#arrays--bracket-newline) Use line breaks after opening array brackets and before closing array brackets, if an array has multiple lines\n\n    ```javascript\n    // bad\n    const arr = [\n      [0, 1], [2, 3], [4, 5],\n    ];\n\n    const objectInArray = [{\n      id: 1,\n    }, {\n      id: 2,\n    }];\n\n    const numberInArray = [\n      1, 2,\n    ];\n\n    // good\n    const arr = [[0, 1], [2, 3], [4, 5]];\n\n    const objectInArray = [\n      {\n        id: 1,\n      },\n      {\n        id: 2,\n      },\n    ];\n\n    const numberInArray = [\n      1,\n      2,\n    ];\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Destructuring\n\n  \u003ca name=\"destructuring--object\"\u003e\u003c/a\u003e\u003ca name=\"5.1\"\u003e\u003c/a\u003e\n  - [5.1](#destructuring--object) Use object destructuring when accessing and using multiple properties of an object. eslint: [`prefer-destructuring`](https://eslint.org/docs/rules/prefer-destructuring)\n\n    \u003e Why? Destructuring saves you from creating temporary references for those properties, and from repetitive access of the object. Repeating object access creates more repetitive code, requires more reading, and creates more opportunities for mistakes. Destructuring objects also provides a single site of definition of the object structure that is used in the block, rather than requiring reading the entire block to determine what is used.\n\n    ```javascript\n    // bad\n    function getFullName(user) {\n      const firstName = user.firstName;\n      const lastName = user.lastName;\n\n      return `${firstName} ${lastName}`;\n    }\n\n    // good\n    function getFullName(user) {\n      const { firstName, lastName } = user;\n      return `${firstName} ${lastName}`;\n    }\n\n    // best\n    function getFullName({ firstName, lastName }) {\n      return `${firstName} ${lastName}`;\n    }\n    ```\n\n  \u003ca name=\"destructuring--array\"\u003e\u003c/a\u003e\u003ca name=\"5.2\"\u003e\u003c/a\u003e\n  - [5.2](#destructuring--array) Use array destructuring. eslint: [`prefer-destructuring`](https://eslint.org/docs/rules/prefer-destructuring)\n\n    ```javascript\n    const arr = [1, 2, 3, 4];\n\n    // bad\n    const first = arr[0];\n    const second = arr[1];\n\n    // good\n    const [first, second] = arr;\n    ```\n\n  \u003ca name=\"destructuring--object-over-array\"\u003e\u003c/a\u003e\u003ca name=\"5.3\"\u003e\u003c/a\u003e\n  - [5.3](#destructuring--object-over-array) Use object destructuring for multiple return values, not array destructuring.\n\n    \u003e Why? You can add new properties over time or change the order of things without breaking call sites.\n\n    ```javascript\n    // bad\n    function processInput(input) {\n      // then a miracle occurs\n      return [left, right, top, bottom];\n    }\n\n    // the caller needs to think about the order of return data\n    const [left, __, top] = processInput(input);\n\n    // good\n    function processInput(input) {\n      // then a miracle occurs\n      return { left, right, top, bottom };\n    }\n\n    // the caller selects only the data they need\n    const { left, top } = processInput(input);\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Strings\n\n  \u003ca name=\"strings--quotes\"\u003e\u003c/a\u003e\u003ca name=\"6.1\"\u003e\u003c/a\u003e\n  - [6.1](#strings--quotes) Use single quotes `''` for strings. eslint: [`quotes`](https://eslint.org/docs/rules/quotes)\n\n    ```javascript\n    // bad\n    const name = \"Capt. Janeway\";\n\n    // bad - template literals should contain interpolation or newlines\n    const name = `Capt. Janeway`;\n\n    // good\n    const name = 'Capt. Janeway';\n    ```\n\n  \u003ca name=\"strings--line-length\"\u003e\u003c/a\u003e\u003ca name=\"6.2\"\u003e\u003c/a\u003e\n  - [6.2](#strings--line-length) Strings that cause the line to go over 100 characters should not be written across multiple lines using string concatenation.\n\n    \u003e Why? Broken strings are painful to work with and make code less searchable.\n\n    ```javascript\n    // bad\n    const errorMessage = 'This is a super long error that was thrown because \\\n    of Batman. When you stop to think about how Batman had anything to do \\\n    with this, you would get nowhere \\\n    fast.';\n\n    // bad\n    const errorMessage = 'This is a super long error that was thrown because ' +\n      'of Batman. When you stop to think about how Batman had anything to do ' +\n      'with this, you would get nowhere fast.';\n\n    // good\n    const errorMessage = 'This is a super long error that was thrown because of Batman. When you stop to think about how Batman had anything to do with this, you would get nowhere fast.';\n    ```\n\n  \u003ca name=\"es6-template-literals\"\u003e\u003c/a\u003e\u003ca name=\"6.4\"\u003e\u003c/a\u003e\n  - [6.3](#es6-template-literals) When programmatically building up strings, use template strings instead of concatenation. eslint: [`prefer-template`](https://eslint.org/docs/rules/prefer-template) [`template-curly-spacing`](https://eslint.org/docs/rules/template-curly-spacing)\n\n    \u003e Why? Template strings give you a readable, concise syntax with proper newlines and string interpolation features.\n\n    ```javascript\n    // bad\n    function sayHi(name) {\n      return 'How are you, ' + name + '?';\n    }\n\n    // bad\n    function sayHi(name) {\n      return ['How are you, ', name, '?'].join();\n    }\n\n    // bad\n    function sayHi(name) {\n      return `How are you, ${ name }?`;\n    }\n\n    // good\n    function sayHi(name) {\n      return `How are you, ${name}?`;\n    }\n    ```\n\n  \u003ca name=\"strings--eval\"\u003e\u003c/a\u003e\u003ca name=\"6.5\"\u003e\u003c/a\u003e\n  - [6.4](#strings--eval) Never use `eval()` on a string; it opens too many vulnerabilities. eslint: [`no-eval`](https://eslint.org/docs/rules/no-eval)\n\n  \u003ca name=\"strings--escaping\"\u003e\u003c/a\u003e\n  - [6.5](#strings--escaping) Do not unnecessarily escape characters in strings. eslint: [`no-useless-escape`](https://eslint.org/docs/rules/no-useless-escape)\n\n    \u003e Why? Backslashes harm readability, thus they should only be present when necessary.\n\n    ```javascript\n    // bad\n    const foo = '\\'this\\' \\i\\s \\\"quoted\\\"';\n\n    // good\n    const foo = '\\'this\\' is \"quoted\"';\n    const foo = `my name is '${name}'`;\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Functions\n\n  \u003ca name=\"functions--declarations\"\u003e\u003c/a\u003e\u003ca name=\"7.1\"\u003e\u003c/a\u003e\n  - [7.1](#functions--declarations) Use named function expressions instead of function declarations. eslint: [`func-style`](https://eslint.org/docs/rules/func-style), [`func-names`](https://eslint.org/docs/latest/rules/func-names)\n\n    \u003e Why? Function declarations are hoisted, which means that it’s easy - too easy - to reference the function before it is defined in the file. This harms readability and maintainability. If you find that a function’s definition is large or complex enough that it is interfering with understanding the rest of the file, then perhaps it’s time to extract it to its own module! Don’t forget to explicitly name the expression, regardless of whether or not the name is inferred from the containing variable (which is often the case in modern browsers or when using compilers such as Babel). This eliminates any assumptions made about the Error’s call stack. ([Discussion](https://github.com/airbnb/javascript/issues/794))\n\n    ```javascript\n    // bad\n    function foo() {\n      // ...\n    }\n\n    // bad\n    const foo = function () {\n      // ...\n    };\n\n    // good\n    // lexical name distinguished from the variable-referenced invocation(s)\n    const short = function longUniqueMoreDescriptiveLexicalFoo() {\n      // ...\n    };\n    ```\n\n  \u003ca name=\"functions--iife\"\u003e\u003c/a\u003e\u003ca name=\"7.2\"\u003e\u003c/a\u003e\n  - [7.2](#functions--iife) Wrap immediately invoked function expressions in parentheses. eslint: [`wrap-iife`](https://eslint.org/docs/rules/wrap-iife)\n\n    \u003e Why? An immediately invoked function expression is a single unit - wrapping both it, and its invocation parens, in parens, cleanly expresses this. Note that in a world with modules everywhere, you almost never need an IIFE.\n\n    ```javascript\n    // immediately-invoked function expression (IIFE)\n    (function () {\n      console.log('Welcome to the Internet. Please follow me.');\n    }());\n    ```\n\n  \u003ca name=\"functions--in-blocks\"\u003e\u003c/a\u003e\u003ca name=\"7.3\"\u003e\u003c/a\u003e\n  - [7.3](#functions--in-blocks) Never declare a function in a non-function block (`if`, `while`, etc). Assign the function to a variable instead. Browsers will allow you to do it, but they all interpret it differently, which is bad news bears. eslint: [`no-loop-func`](https://eslint.org/docs/rules/no-loop-func)\n\n  \u003ca name=\"functions--note-on-blocks\"\u003e\u003c/a\u003e\u003ca name=\"7.4\"\u003e\u003c/a\u003e\n  - [7.4](#functions--note-on-blocks) **Note:** ECMA-262 defines a `block` as a list of statements. A function declaration is not a statement.\n\n    ```javascript\n    // bad\n    if (currentUser) {\n      function test() {\n        console.log('Nope.');\n      }\n    }\n\n    // good\n    let test;\n    if (currentUser) {\n      test = () =\u003e {\n        console.log('Yup.');\n      };\n    }\n    ```\n\n  \u003ca name=\"functions--arguments-shadow\"\u003e\u003c/a\u003e\u003ca name=\"7.5\"\u003e\u003c/a\u003e\n  - [7.5](#functions--arguments-shadow) Never name a parameter `arguments`. This will take precedence over the `arguments` object that is given to every function scope.\n\n    ```javascript\n    // bad\n    function foo(name, options, arguments) {\n      // ...\n    }\n\n    // good\n    function foo(name, options, args) {\n      // ...\n    }\n    ```\n\n  \u003ca name=\"es6-rest\"\u003e\u003c/a\u003e\u003ca name=\"7.6\"\u003e\u003c/a\u003e\n  - [7.6](#es6-rest) Never use `arguments`, opt to use rest syntax `...` instead. eslint: [`prefer-rest-params`](https://eslint.org/docs/rules/prefer-rest-params)\n\n    \u003e Why? `...` is explicit about which arguments you want pulled. Plus, rest arguments are a real Array, and not merely Array-like like `arguments`.\n\n    ```javascript\n    // bad\n    function concatenateAll() {\n      const args = Array.prototype.slice.call(arguments);\n      return args.join('');\n    }\n\n    // good\n    function concatenateAll(...args) {\n      return args.join('');\n    }\n    ```\n\n  \u003ca name=\"es6-default-parameters\"\u003e\u003c/a\u003e\u003ca name=\"7.7\"\u003e\u003c/a\u003e\n  - [7.7](#es6-default-parameters) Use default parameter syntax rather than mutating function arguments.\n\n    ```javascript\n    // really bad\n    function handleThings(opts) {\n      // No! We shouldn’t mutate function arguments.\n      // Double bad: if opts is falsy it'll be set to an object which may\n      // be what you want but it can introduce subtle bugs.\n      opts = opts || {};\n      // ...\n    }\n\n    // still bad\n    function handleThings(opts) {\n      if (opts === void 0) {\n        opts = {};\n      }\n      // ...\n    }\n\n    // good\n    function handleThings(opts = {}) {\n      // ...\n    }\n    ```\n\n  \u003ca name=\"functions--default-side-effects\"\u003e\u003c/a\u003e\u003ca name=\"7.8\"\u003e\u003c/a\u003e\n  - [7.8](#functions--default-side-effects) Avoid side effects with default parameters.\n\n    \u003e Why? They are confusing to reason about.\n\n    ```javascript\n    let b = 1;\n    // bad\n    function count(a = b++) {\n      console.log(a);\n    }\n    count();  // 1\n    count();  // 2\n    count(3); // 3\n    count();  // 3\n    ```\n\n  \u003ca name=\"functions--defaults-last\"\u003e\u003c/a\u003e\u003ca name=\"7.9\"\u003e\u003c/a\u003e\n  - [7.9](#functions--defaults-last) Always put default parameters last. eslint: [`default-param-last`](https://eslint.org/docs/rules/default-param-last)\n\n    ```javascript\n    // bad\n    function handleThings(opts = {}, name) {\n      // ...\n    }\n\n    // good\n    function handleThings(name, opts = {}) {\n      // ...\n    }\n    ```\n\n  \u003ca name=\"functions--constructor\"\u003e\u003c/a\u003e\u003ca name=\"7.10\"\u003e\u003c/a\u003e\n  - [7.10](#functions--constructor) Never use the Function constructor to create a new function. eslint: [`no-new-func`](https://eslint.org/docs/rules/no-new-func)\n\n    \u003e Why? Creating a function in this way evaluates a string similarly to `eval()`, which opens vulnerabilities.\n\n    ```javascript\n    // bad\n    const add = new Function('a', 'b', 'return a + b');\n\n    // still bad\n    const subtract = Function('a', 'b', 'return a - b');\n    ```\n\n  \u003ca name=\"functions--signature-spacing\"\u003e\u003c/a\u003e\u003ca name=\"7.11\"\u003e\u003c/a\u003e\n  - [7.11](#functions--signature-spacing) Spacing in a function signature. eslint: [`space-before-function-paren`](https://eslint.org/docs/rules/space-before-function-paren) [`space-before-blocks`](https://eslint.org/docs/rules/space-before-blocks)\n\n    \u003e Why? Consistency is good, and you shouldn’t have to add or remove a space when adding or removing a name.\n\n    ```javascript\n    // bad\n    const f = function(){};\n    const g = function (){};\n    const h = function() {};\n\n    // good\n    const x = function () {};\n    const y = function a() {};\n    ```\n\n  \u003ca name=\"functions--mutate-params\"\u003e\u003c/a\u003e\u003ca name=\"7.12\"\u003e\u003c/a\u003e\n  - [7.12](#functions--mutate-params) Never mutate parameters. eslint: [`no-param-reassign`](https://eslint.org/docs/rules/no-param-reassign)\n\n    \u003e Why? Manipulating objects passed in as parameters can cause unwanted variable side effects in the original caller.\n\n    ```javascript\n    // bad\n    function f1(obj) {\n      obj.key = 1;\n    }\n\n    // good\n    function f2(obj) {\n      const key = Object.prototype.hasOwnProperty.call(obj, 'key') ? obj.key : 1;\n    }\n    ```\n\n  \u003ca name=\"functions--reassign-params\"\u003e\u003c/a\u003e\u003ca name=\"7.13\"\u003e\u003c/a\u003e\n  - [7.13](#functions--reassign-params) Never reassign parameters. eslint: [`no-param-reassign`](https://eslint.org/docs/rules/no-param-reassign)\n\n    \u003e Why? Reassigning parameters can lead to unexpected behavior, especially when accessing the `arguments` object. It can also cause optimization issues, especially in V8.\n\n    ```javascript\n    // bad\n    function f1(a) {\n      a = 1;\n      // ...\n    }\n\n    function f2(a) {\n      if (!a) { a = 1; }\n      // ...\n    }\n\n    // good\n    function f3(a) {\n      const b = a || 1;\n      // ...\n    }\n\n    function f4(a = 1) {\n      // ...\n    }\n    ```\n\n  \u003ca name=\"functions--spread-vs-apply\"\u003e\u003c/a\u003e\u003ca name=\"7.14\"\u003e\u003c/a\u003e\n  - [7.14](#functions--spread-vs-apply) Prefer the use of the spread syntax `...` to call variadic functions. eslint: [`prefer-spread`](https://eslint.org/docs/rules/prefer-spread)\n\n    \u003e Why? It’s cleaner, you don’t need to supply a context, and you can not easily compose `new` with `apply`.\n\n    ```javascript\n    // bad\n    const x = [1, 2, 3, 4, 5];\n    console.log.apply(console, x);\n\n    // good\n    const x = [1, 2, 3, 4, 5];\n    console.log(...x);\n\n    // bad\n    new (Function.prototype.bind.apply(Date, [null, 2016, 8, 5]));\n\n    // good\n    new Date(...[2016, 8, 5]);\n    ```\n\n  \u003ca name=\"functions--signature-invocation-indentation\"\u003e\u003c/a\u003e\n  - [7.15](#functions--signature-invocation-indentation) Functions with multiline signatures, or invocations, should be indented just like every other multiline list in this guide: with each item on a line by itself, with a trailing comma on the last item. eslint: [`function-paren-newline`](https://eslint.org/docs/rules/function-paren-newline)\n\n    ```javascript\n    // bad\n    function foo(bar,\n                 baz,\n                 quux) {\n      // ...\n    }\n\n    // good\n    function foo(\n      bar,\n      baz,\n      quux,\n    ) {\n      // ...\n    }\n\n    // bad\n    console.log(foo,\n      bar,\n      baz);\n\n    // good\n    console.log(\n      foo,\n      bar,\n      baz,\n    );\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Arrow Functions\n\n  \u003ca name=\"arrows--use-them\"\u003e\u003c/a\u003e\u003ca name=\"8.1\"\u003e\u003c/a\u003e\n  - [8.1](#arrows--use-them) When you must use an anonymous function (as when passing an inline callback), use arrow function notation. eslint: [`prefer-arrow-callback`](https://eslint.org/docs/rules/prefer-arrow-callback), [`arrow-spacing`](https://eslint.org/docs/rules/arrow-spacing)\n\n    \u003e Why? It creates a version of the function that executes in the context of `this`, which is usually what you want, and is a more concise syntax.\n\n    \u003e Why not? If you have a fairly complicated function, you might move that logic out into its own named function expression.\n\n    ```javascript\n    // bad\n    [1, 2, 3].map(function (x) {\n      const y = x + 1;\n      return x * y;\n    });\n\n    // good\n    [1, 2, 3].map((x) =\u003e {\n      const y = x + 1;\n      return x * y;\n    });\n    ```\n\n  \u003ca name=\"arrows--implicit-return\"\u003e\u003c/a\u003e\u003ca name=\"8.2\"\u003e\u003c/a\u003e\n  - [8.2](#arrows--implicit-return) If the function body consists of a single statement returning an [expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Expressions) without side effects, omit the braces and use the implicit return. Otherwise, keep the braces and use a `return` statement. eslint: [`arrow-parens`](https://eslint.org/docs/rules/arrow-parens), [`arrow-body-style`](https://eslint.org/docs/rules/arrow-body-style)\n\n    \u003e Why? Syntactic sugar. It reads well when multiple functions are chained together.\n\n    ```javascript\n    // bad\n    [1, 2, 3].map((number) =\u003e {\n      const nextNumber = number + 1;\n      `A string containing the ${nextNumber}.`;\n    });\n\n    // good\n    [1, 2, 3].map((number) =\u003e `A string containing the ${number + 1}.`);\n\n    // good\n    [1, 2, 3].map((number) =\u003e {\n      const nextNumber = number + 1;\n      return `A string containing the ${nextNumber}.`;\n    });\n\n    // good\n    [1, 2, 3].map((number, index) =\u003e ({\n      [index]: number,\n    }));\n\n    // No implicit return with side effects\n    function foo(callback) {\n      const val = callback();\n      if (val === true) {\n        // Do something if callback returns true\n      }\n    }\n\n    let bool = false;\n\n    // bad\n    foo(() =\u003e bool = true);\n\n    // good\n    foo(() =\u003e {\n      bool = true;\n    });\n    ```\n\n  \u003ca name=\"arrows--paren-wrap\"\u003e\u003c/a\u003e\u003ca name=\"8.3\"\u003e\u003c/a\u003e\n  - [8.3](#arrows--paren-wrap) In case the expression spans over multiple lines, wrap it in parentheses for better readability.\n\n    \u003e Why? It shows clearly where the function starts and ends.\n\n    ```javascript\n    // bad\n    ['get', 'post', 'put'].map((httpMethod) =\u003e Object.prototype.hasOwnProperty.call(\n        httpMagicObjectWithAVeryLongName,\n        httpMethod,\n      )\n    );\n\n    // good\n    ['get', 'post', 'put'].map((httpMethod) =\u003e (\n      Object.prototype.hasOwnProperty.call(\n        httpMagicObjectWithAVeryLongName,\n        httpMethod,\n      )\n    ));\n    ```\n\n  \u003ca name=\"arrows--one-arg-parens\"\u003e\u003c/a\u003e\u003ca name=\"8.4\"\u003e\u003c/a\u003e\n  - [8.4](#arrows--one-arg-parens) Always include parentheses around arguments for clarity and consistency. eslint: [`arrow-parens`](https://eslint.org/docs/rules/arrow-parens)\n\n    \u003e Why? Minimizes diff churn when adding or removing arguments.\n\n    ```javascript\n    // bad\n    [1, 2, 3].map(x =\u003e x * x);\n\n    // good\n    [1, 2, 3].map((x) =\u003e x * x);\n\n    // bad\n    [1, 2, 3].map(number =\u003e (\n      `A long string with the ${number}. It’s so long that we don’t want it to take up space on the .map line!`\n    ));\n\n    // good\n    [1, 2, 3].map((number) =\u003e (\n      `A long string with the ${number}. It’s so long that we don’t want it to take up space on the .map line!`\n    ));\n\n    // bad\n    [1, 2, 3].map(x =\u003e {\n      const y = x + 1;\n      return x * y;\n    });\n\n    // good\n    [1, 2, 3].map((x) =\u003e {\n      const y = x + 1;\n      return x * y;\n    });\n    ```\n\n  \u003ca name=\"arrows--confusing\"\u003e\u003c/a\u003e\u003ca name=\"8.5\"\u003e\u003c/a\u003e\n  - [8.5](#arrows--confusing) Avoid confusing arrow function syntax (`=\u003e`) with comparison operators (`\u003c=`, `\u003e=`). eslint: [`no-confusing-arrow`](https://eslint.org/docs/rules/no-confusing-arrow)\n\n    ```javascript\n    // bad\n    const itemHeight = (item) =\u003e item.height \u003c= 256 ? item.largeSize : item.smallSize;\n\n    // bad\n    const itemHeight = (item) =\u003e item.height \u003e= 256 ? item.largeSize : item.smallSize;\n\n    // good\n    const itemHeight = (item) =\u003e (item.height \u003c= 256 ? item.largeSize : item.smallSize);\n\n    // good\n    const itemHeight = (item) =\u003e {\n      const { height, largeSize, smallSize } = item;\n      return height \u003c= 256 ? largeSize : smallSize;\n    };\n    ```\n\n  \u003ca name=\"whitespace--implicit-arrow-linebreak\"\u003e\u003c/a\u003e\n  - [8.6](#whitespace--implicit-arrow-linebreak) Enforce the location of arrow function bodies with implicit returns. eslint: [`implicit-arrow-linebreak`](https://eslint.org/docs/rules/implicit-arrow-linebreak)\n\n    ```javascript\n    // bad\n    (foo) =\u003e\n      bar;\n\n    (foo) =\u003e\n      (bar);\n\n    // good\n    (foo) =\u003e bar;\n    (foo) =\u003e (bar);\n    (foo) =\u003e (\n       bar\n    )\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Classes \u0026 Constructors\n\n  \u003ca name=\"constructors--use-class\"\u003e\u003c/a\u003e\u003ca name=\"9.1\"\u003e\u003c/a\u003e\n  - [9.1](#constructors--use-class) Always use `class`. Avoid manipulating `prototype` directly.\n\n    \u003e Why? `class` syntax is more concise and easier to reason about.\n\n    ```javascript\n    // bad\n    function Queue(contents = []) {\n      this.queue = [...contents];\n    }\n    Queue.prototype.pop = function () {\n      const value = this.queue[0];\n      this.queue.splice(0, 1);\n      return value;\n    };\n\n    // good\n    class Queue {\n      constructor(contents = []) {\n        this.queue = [...contents];\n      }\n      pop() {\n        const value = this.queue[0];\n        this.queue.splice(0, 1);\n        return value;\n      }\n    }\n    ```\n\n  \u003ca name=\"constructors--extends\"\u003e\u003c/a\u003e\u003ca name=\"9.2\"\u003e\u003c/a\u003e\n  - [9.2](#constructors--extends) Use `extends` for inheritance.\n\n    \u003e Why? It is a built-in way to inherit prototype functionality without breaking `instanceof`.\n\n    ```javascript\n    // bad\n    const inherits = require('inherits');\n    function PeekableQueue(contents) {\n      Queue.apply(this, contents);\n    }\n    inherits(PeekableQueue, Queue);\n    PeekableQueue.prototype.peek = function () {\n      return this.queue[0];\n    };\n\n    // good\n    class PeekableQueue extends Queue {\n      peek() {\n        return this.queue[0];\n      }\n    }\n    ```\n\n  \u003ca name=\"constructors--chaining\"\u003e\u003c/a\u003e\u003ca name=\"9.3\"\u003e\u003c/a\u003e\n  - [9.3](#constructors--chaining) Methods can return `this` to help with method chaining.\n\n    ```javascript\n    // bad\n    Jedi.prototype.jump = function () {\n      this.jumping = true;\n      return true;\n    };\n\n    Jedi.prototype.setHeight = function (height) {\n      this.height = height;\n    };\n\n    const luke = new Jedi();\n    luke.jump(); // =\u003e true\n    luke.setHeight(20); // =\u003e undefined\n\n    // good\n    class Jedi {\n      jump() {\n        this.jumping = true;\n        return this;\n      }\n\n      setHeight(height) {\n        this.height = height;\n        return this;\n      }\n    }\n\n    const luke = new Jedi();\n\n    luke.jump()\n      .setHeight(20);\n    ```\n\n  \u003ca name=\"constructors--tostring\"\u003e\u003c/a\u003e\u003ca name=\"9.4\"\u003e\u003c/a\u003e\n  - [9.4](#constructors--tostring) It’s okay to write a custom `toString()` method, just make sure it works successfully and causes no side effects.\n\n    ```javascript\n    class Jedi {\n      constructor(options = {}) {\n        this.name = options.name || 'no name';\n      }\n\n      getName() {\n        return this.name;\n      }\n\n      toString() {\n        return `Jedi - ${this.getName()}`;\n      }\n    }\n    ```\n\n  \u003ca name=\"constructors--no-useless\"\u003e\u003c/a\u003e\u003ca name=\"9.5\"\u003e\u003c/a\u003e\n  - [9.5](#constructors--no-useless) Classes have a default constructor if one is not specified. An empty constructor function or one that just delegates to a parent class is unnecessary. eslint: [`no-useless-constructor`](https://eslint.org/docs/rules/no-useless-constructor)\n\n    ```javascript\n    // bad\n    class Jedi {\n      constructor() {}\n\n      getName() {\n        return this.name;\n      }\n    }\n\n    // bad\n    class Rey extends Jedi {\n      constructor(...args) {\n        super(...args);\n      }\n    }\n\n    // good\n    class Rey extends Jedi {\n      constructor(...args) {\n        super(...args);\n        this.name = 'Rey';\n      }\n    }\n    ```\n\n  \u003ca name=\"classes--no-duplicate-members\"\u003e\u003c/a\u003e\n  - [9.6](#classes--no-duplicate-members) Avoid duplicate class members. eslint: [`no-dupe-class-members`](https://eslint.org/docs/rules/no-dupe-class-members)\n\n    \u003e Why? Duplicate class member declarations will silently prefer the last one - having duplicates is almost certainly a bug.\n\n    ```javascript\n    // bad\n    class Foo {\n      bar() { return 1; }\n      bar() { return 2; }\n    }\n\n    // good\n    class Foo {\n      bar() { return 1; }\n    }\n\n    // good\n    class Foo {\n      bar() { return 2; }\n    }\n    ```\n\n  \u003ca name=\"classes--methods-use-this\"\u003e\u003c/a\u003e\n  - [9.7](#classes--methods-use-this) Class methods should use `this` or be made into a static method unless an external library or framework requires using specific non-static methods. Being an instance method should indicate that it behaves differently based on properties of the receiver. eslint: [`class-methods-use-this`](https://eslint.org/docs/rules/class-methods-use-this)\n\n    ```javascript\n    // bad\n    class Foo {\n      bar() {\n        console.log('bar');\n      }\n    }\n\n    // good - this is used\n    class Foo {\n      bar() {\n        console.log(this.bar);\n      }\n    }\n\n    // good - constructor is exempt\n    class Foo {\n      constructor() {\n        // ...\n      }\n    }\n\n    // good - static methods aren't expected to use this\n    class Foo {\n      static bar() {\n        console.log('bar');\n      }\n    }\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Modules\n\n  \u003ca name=\"modules--use-them\"\u003e\u003c/a\u003e\u003ca name=\"10.1\"\u003e\u003c/a\u003e\n  - [10.1](#modules--use-them) Always use modules (`import`/`export`) over a non-standard module system. You can always transpile to your preferred module system.\n\n    \u003e Why? Modules are the future, let’s start using the future now.\n\n    ```javascript\n    // bad\n    const AirbnbStyleGuide = require('./AirbnbStyleGuide');\n    module.exports = AirbnbStyleGuide.es6;\n\n    // ok\n    import AirbnbStyleGuide from './AirbnbStyleGuide';\n    export default AirbnbStyleGuide.es6;\n\n    // best\n    import { es6 } from './AirbnbStyleGuide';\n    export default es6;\n    ```\n\n  \u003ca name=\"modules--no-wildcard\"\u003e\u003c/a\u003e\u003ca name=\"10.2\"\u003e\u003c/a\u003e\n  - [10.2](#modules--no-wildcard) Do not use wildcard imports.\n\n    \u003e Why? This makes sure you have a single default export.\n\n    ```javascript\n    // bad\n    import * as AirbnbStyleGuide from './AirbnbStyleGuide';\n\n    // good\n    import AirbnbStyleGuide from './AirbnbStyleGuide';\n    ```\n\n  \u003ca name=\"modules--no-export-from-import\"\u003e\u003c/a\u003e\u003ca name=\"10.3\"\u003e\u003c/a\u003e\n  - [10.3](#modules--no-export-from-import) And do not export directly from an import.\n\n    \u003e Why? Although the one-liner is concise, having one clear way to import and one clear way to export makes things consistent.\n\n    ```javascript\n    // bad\n    // filename es6.js\n    export { es6 as default } from './AirbnbStyleGuide';\n\n    // good\n    // filename es6.js\n    import { es6 } from './AirbnbStyleGuide';\n    export default es6;\n    ```\n\n  \u003ca name=\"modules--no-duplicate-imports\"\u003e\u003c/a\u003e\n  - [10.4](#modules--no-duplicate-imports) Only import from a path in one place.\n eslint: [`no-duplicate-imports`](https://eslint.org/docs/rules/no-duplicate-imports)\n    \u003e Why? Having multiple lines that import from the same path can make code harder to maintain.\n\n    ```javascript\n    // bad\n    import foo from 'foo';\n    // … some other imports … //\n    import { named1, named2 } from 'foo';\n\n    // good\n    import foo, { named1, named2 } from 'foo';\n\n    // good\n    import foo, {\n      named1,\n      named2,\n    } from 'foo';\n    ```\n\n  \u003ca name=\"modules--no-mutable-exports\"\u003e\u003c/a\u003e\n  - [10.5](#modules--no-mutable-exports) Do not export mutable bindings.\n eslint: [`import/no-mutable-exports`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md)\n    \u003e Why? Mutation should be avoided in general, but in particular when exporting mutable bindings. While this technique may be needed for some special cases, in general, only constant references should be exported.\n\n    ```javascript\n    // bad\n    let foo = 3;\n    export { foo };\n\n    // good\n    const foo = 3;\n    export { foo };\n    ```\n\n  \u003ca name=\"modules--prefer-default-export\"\u003e\u003c/a\u003e\n  - [10.6](#modules--prefer-default-export) In modules with a single export, prefer default export over named export.\n eslint: [`import/prefer-default-export`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md)\n    \u003e Why? To encourage more files that only ever export one thing, which is better for readability and maintainability.\n\n    ```javascript\n    // bad\n    export function foo() {}\n\n    // good\n    export default function foo() {}\n    ```\n\n  \u003ca name=\"modules--imports-first\"\u003e\u003c/a\u003e\n  - [10.7](#modules--imports-first) Put all `import`s above non-import statements.\n eslint: [`import/first`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/first.md)\n    \u003e Why? Since `import`s are hoisted, keeping them all at the top prevents surprising behavior.\n\n    ```javascript\n    // bad\n    import foo from 'foo';\n    foo.init();\n\n    import bar from 'bar';\n\n    // good\n    import foo from 'foo';\n    import bar from 'bar';\n\n    foo.init();\n    ```\n\n  \u003ca name=\"modules--multiline-imports-over-newlines\"\u003e\u003c/a\u003e\n  - [10.8](#modules--multiline-imports-over-newlines) Multiline imports should be indented just like multiline array and object literals.\n eslint: [`object-curly-newline`](https://eslint.org/docs/rules/object-curly-newline)\n\n    \u003e Why? The curly braces follow the same indentation rules as every other curly brace block in the style guide, as do the trailing commas.\n\n    ```javascript\n    // bad\n    import {longNameA, longNameB, longNameC, longNameD, longNameE} from 'path';\n\n    // good\n    import {\n      longNameA,\n      longNameB,\n      longNameC,\n      longNameD,\n      longNameE,\n    } from 'path';\n    ```\n\n  \u003ca name=\"modules--no-webpack-loader-syntax\"\u003e\u003c/a\u003e\n  - [10.9](#modules--no-webpack-loader-syntax) Disallow Webpack loader syntax in module import statements.\n eslint: [`import/no-webpack-loader-syntax`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md)\n    \u003e Why? Since using Webpack syntax in the imports couples the code to a module bundler. Prefer using the loader syntax in `webpack.config.js`.\n\n    ```javascript\n    // bad\n    import fooSass from 'css!sass!foo.scss';\n    import barCss from 'style!css!bar.css';\n\n    // good\n    import fooSass from 'foo.scss';\n    import barCss from 'bar.css';\n    ```\n\n  \u003ca name=\"modules--import-extensions\"\u003e\u003c/a\u003e\n  - [10.10](#modules--import-extensions) Do not include JavaScript filename extensions\n eslint: [`import/extensions`](https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/extensions.md)\n    \u003e Why? Including extensions inhibits refactoring, and inappropriately hardcodes implementation details of the module you're importing in every consumer.\n\n    ```javascript\n    // bad\n    import foo from './foo.js';\n    import bar from './bar.jsx';\n    import baz from './baz/index.jsx';\n\n    // good\n    import foo from './foo';\n    import bar from './bar';\n    import baz from './baz';\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Iterators and Generators\n\n  \u003ca name=\"iterators--nope\"\u003e\u003c/a\u003e\u003ca name=\"11.1\"\u003e\u003c/a\u003e\n  - [11.1](#iterators--nope) Don’t use iterators. Prefer JavaScript’s higher-order functions instead of loops like `for-in` or `for-of`. eslint: [`no-iterator`](https://eslint.org/docs/rules/no-iterator) [`no-restricted-syntax`](https://eslint.org/docs/rules/no-restricted-syntax)\n\n    \u003e Why? This enforces our immutable rule. Dealing with pure functions that return values is easier to reason about than side effects.\n\n    \u003e Use `map()` / `every()` / `filter()` / `find()` / `findIndex()` / `reduce()` / `some()` / ... to iterate over arrays, and `Object.keys()` / `Object.values()` / `Object.entries()` to produce arrays so you can iterate over objects.\n\n    ```javascript\n    const numbers = [1, 2, 3, 4, 5];\n\n    // bad\n    let sum = 0;\n    for (let num of numbers) {\n      sum += num;\n    }\n    sum === 15;\n\n    // good\n    let sum = 0;\n    numbers.forEach((num) =\u003e {\n      sum += num;\n    });\n    sum === 15;\n\n    // best (use the functional force)\n    const sum = numbers.reduce((total, num) =\u003e total + num, 0);\n    sum === 15;\n\n    // bad\n    const increasedByOne = [];\n    for (let i = 0; i \u003c numbers.length; i++) {\n      increasedByOne.push(numbers[i] + 1);\n    }\n\n    // good\n    const increasedByOne = [];\n    numbers.forEach((num) =\u003e {\n      increasedByOne.push(num + 1);\n    });\n\n    // best (keeping it functional)\n    const increasedByOne = numbers.map((num) =\u003e num + 1);\n    ```\n\n  \u003ca name=\"generators--nope\"\u003e\u003c/a\u003e\u003ca name=\"11.2\"\u003e\u003c/a\u003e\n  - [11.2](#generators--nope) Don’t use generators for now.\n\n    \u003e Why? They don’t transpile well to ES5.\n\n  \u003ca name=\"generators--spacing\"\u003e\u003c/a\u003e\n  - [11.3](#generators--spacing) If you must use generators, or if you disregard [our advice](#generators--nope), make sure their function signature is spaced properly. eslint: [`generator-star-spacing`](https://eslint.org/docs/rules/generator-star-spacing)\n\n    \u003e Why? `function` and `*` are part of the same conceptual keyword - `*` is not a modifier for `function`, `function*` is a unique construct, different from `function`.\n\n    ```javascript\n    // bad\n    function * foo() {\n      // ...\n    }\n\n    // bad\n    const bar = function * () {\n      // ...\n    };\n\n    // bad\n    const baz = function *() {\n      // ...\n    };\n\n    // bad\n    const quux = function*() {\n      // ...\n    };\n\n    // bad\n    function*foo() {\n      // ...\n    }\n\n    // bad\n    function *foo() {\n      // ...\n    }\n\n    // very bad\n    function\n    *\n    foo() {\n      // ...\n    }\n\n    // very bad\n    const wat = function\n    *\n    () {\n      // ...\n    };\n\n    // good\n    function* foo() {\n      // ...\n    }\n\n    // good\n    const foo = function* () {\n      // ...\n    };\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Properties\n\n  \u003ca name=\"properties--dot\"\u003e\u003c/a\u003e\u003ca name=\"12.1\"\u003e\u003c/a\u003e\n  - [12.1](#properties--dot) Use dot notation when accessing properties. eslint: [`dot-notation`](https://eslint.org/docs/rules/dot-notation)\n\n    ```javascript\n    const luke = {\n      jedi: true,\n      age: 28,\n    };\n\n    // bad\n    const isJedi = luke['jedi'];\n\n    // good\n    const isJedi = luke.jedi;\n    ```\n\n  \u003ca name=\"properties--bracket\"\u003e\u003c/a\u003e\u003ca name=\"12.2\"\u003e\u003c/a\u003e\n  - [12.2](#properties--bracket) Use bracket notation `[]` when accessing properties with a variable.\n\n    ```javascript\n    const luke = {\n      jedi: true,\n      age: 28,\n    };\n\n    function getProp(prop) {\n      return luke[prop];\n    }\n\n    const isJedi = getProp('jedi');\n    ```\n\n  \u003ca name=\"es2016-properties--exponentiation-operator\"\u003e\u003c/a\u003e\n  - [12.3](#es2016-properties--exponentiation-operator) Use exponentiation operator `**` when calculating exponentiations. eslint: [`prefer-exponentiation-operator`](https://eslint.org/docs/rules/prefer-exponentiation-operator).\n\n    ```javascript\n    // bad\n    const binary = Math.pow(2, 10);\n\n    // good\n    const binary = 2 ** 10;\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Variables\n\n  \u003ca name=\"variables--const\"\u003e\u003c/a\u003e\u003ca name=\"13.1\"\u003e\u003c/a\u003e\n  - [13.1](#variables--const) Always use `const` or `let` to declare variables. Not doing so will result in global variables. We want to avoid polluting the global namespace. Captain Planet warned us of that. eslint: [`no-undef`](https://eslint.org/docs/rules/no-undef) [`prefer-const`](https://eslint.org/docs/rules/prefer-const)\n\n    ```javascript\n    // bad\n    superPower = new SuperPower();\n\n    // good\n    const superPower = new SuperPower();\n    ```\n\n  \u003ca name=\"variables--one-const\"\u003e\u003c/a\u003e\u003ca name=\"13.2\"\u003e\u003c/a\u003e\n  - [13.2](#variables--one-const) Use one `const` or `let` declaration per variable or assignment. eslint: [`one-var`](https://eslint.org/docs/rules/one-var)\n\n    \u003e Why? It’s easier to add new variable declarations this way, and you never have to worry about swapping out a `;` for a `,` or introducing punctuation-only diffs. You can also step through each declaration with the debugger, instead of jumping through all of them at once.\n\n    ```javascript\n    // bad\n    const items = getItems(),\n        goSportsTeam = true,\n        dragonball = 'z';\n\n    // bad\n    // (compare to above, and try to spot the mistake)\n    const items = getItems(),\n        goSportsTeam = true;\n        dragonball = 'z';\n\n    // good\n    const items = getItems();\n    const goSportsTeam = true;\n    const dragonball = 'z';\n    ```\n\n  \u003ca name=\"variables--const-let-group\"\u003e\u003c/a\u003e\u003ca name=\"13.3\"\u003e\u003c/a\u003e\n  - [13.3](#variables--const-let-group) Group all your `const`s and then group all your `let`s.\n\n    \u003e Why? This is helpful when later on you might need to assign a variable depending on one of the previously assigned variables.\n\n    ```javascript\n    // bad\n    let i, len, dragonball,\n        items = getItems(),\n        goSportsTeam = true;\n\n    // bad\n    let i;\n    const items = getItems();\n    let dragonball;\n    const goSportsTeam = true;\n    let len;\n\n    // good\n    const goSportsTeam = true;\n    const items = getItems();\n    let dragonball;\n    let i;\n    let length;\n    ```\n\n  \u003ca name=\"variables--define-where-used\"\u003e\u003c/a\u003e\u003ca name=\"13.4\"\u003e\u003c/a\u003e\n  - [13.4](#variables--define-where-used) Assign variables where you need them, but place them in a reasonable place.\n\n    \u003e Why? `let` and `const` are block scoped and not function scoped.\n\n    ```javascript\n    // bad - unnecessary function call\n    function checkName(hasName) {\n      const name = getName();\n\n      if (hasName === 'test') {\n        return false;\n      }\n\n      if (name === 'test') {\n        this.setName('');\n        return false;\n      }\n\n      return name;\n    }\n\n    // good\n    function checkName(hasName) {\n      if (hasName === 'test') {\n        return false;\n      }\n\n      const name = getName();\n\n      if (name === 'test') {\n        this.setName('');\n        return false;\n      }\n\n      return name;\n    }\n    ```\n\n  \u003ca name=\"variables--no-chain-assignment\"\u003e\u003c/a\u003e\u003ca name=\"13.5\"\u003e\u003c/a\u003e\n  - [13.5](#variables--no-chain-assignment) Don’t chain variable assignments. eslint: [`no-multi-assign`](https://eslint.org/docs/rules/no-multi-assign)\n\n    \u003e Why? Chaining variable assignments creates implicit global variables.\n\n    ```javascript\n    // bad\n    (function example() {\n      // JavaScript interprets this as\n      // let a = ( b = ( c = 1 ) );\n      // The let keyword only applies to variable a; variables b and c become\n      // global variables.\n      let a = b = c = 1;\n    }());\n\n    console.log(a); // throws ReferenceError\n    console.log(b); // 1\n    console.log(c); // 1\n\n    // good\n    (function example() {\n      let a = 1;\n      let b = a;\n      let c = a;\n    }());\n\n    console.log(a); // throws ReferenceError\n    console.log(b); // throws ReferenceError\n    console.log(c); // throws ReferenceError\n\n    // the same applies for `const`\n    ```\n\n  \u003ca name=\"variables--unary-increment-decrement\"\u003e\u003c/a\u003e\u003ca name=\"13.6\"\u003e\u003c/a\u003e\n  - [13.6](#variables--unary-increment-decrement) Avoid using unary increments and decrements (`++`, `--`). eslint [`no-plusplus`](https://eslint.org/docs/rules/no-plusplus)\n\n    \u003e Why? Per the eslint documentation, unary increment and decrement statements are subject to automatic semicolon insertion and can cause silent errors with incrementing or decrementing values within an application. It is also more expressive to mutate your values with statements like `num += 1` instead of `num++` or `num ++`. Disallowing unary increment and decrement statements also prevents you from pre-incrementing/pre-decrementing values unintentionally which can also cause unexpected behavior in your programs.\n\n    ```javascript\n    // bad\n\n    const array = [1, 2, 3];\n    let num = 1;\n    num++;\n    --num;\n\n    let sum = 0;\n    let truthyCount = 0;\n    for (let i = 0; i \u003c array.length; i++) {\n      let value = array[i];\n      sum += value;\n      if (value) {\n        truthyCount++;\n      }\n    }\n\n    // good\n\n    const array = [1, 2, 3];\n    let num = 1;\n    num += 1;\n    num -= 1;\n\n    const sum = array.reduce((a, b) =\u003e a + b, 0);\n    const truthyCount = array.filter(Boolean).length;\n    ```\n\n\u003ca name=\"variables--linebreak\"\u003e\u003c/a\u003e\n  - [13.7](#variables--linebreak) Avoid linebreaks before or after `=` in an assignment. If your assignment violates [`max-len`](https://eslint.org/docs/rules/max-len), surround the value in parens. eslint [`operator-linebreak`](https://eslint.org/docs/rules/operator-linebreak).\n\n    \u003e Why? Linebreaks surrounding `=` can obfuscate the value of an assignment.\n\n    ```javascript\n    // bad\n    const foo =\n      superLongLongLongLongLongLongLongLongFunctionName();\n\n    // bad\n    const foo\n      = 'superLongLongLongLongLongLongLongLongString';\n\n    // good\n    const foo = (\n      superLongLongLongLongLongLongLongLongFunctionName()\n    );\n\n    // good\n    const foo = 'superLongLongLongLongLongLongLongLongString';\n    ```\n\n\u003ca name=\"variables--no-unused-vars\"\u003e\u003c/a\u003e\n  - [13.8](#variables--no-unused-vars) Disallow unused variables. eslint: [`no-unused-vars`](https://eslint.org/docs/rules/no-unused-vars)\n\n    \u003e Why? Variables that are declared and not used anywhere in the code are most likely an error due to incomplete refactoring. Such variables take up space in the code and can lead to confusion by readers.\n\n    ```javascript\n    // bad\n\n    const some_unused_var = 42;\n\n    // Write-only variables are not considered as used.\n    let y = 10;\n    y = 5;\n\n    // A read for a modification of itself is not considered as used.\n    let z = 0;\n    z = z + 1;\n\n    // Unused function arguments.\n    function getX(x, y) {\n        return x;\n    }\n\n    // good\n\n    function getXPlusY(x, y) {\n      return x + y;\n    }\n\n    const x = 1;\n    const y = a + 2;\n\n    alert(getXPlusY(x, y));\n\n    // 'type' is ignored even if unused because it has a rest property sibling.\n    // This is a form of extracting an object that omits the specified keys.\n    const { type, ...coords } = data;\n    // 'coords' is now the 'data' object without its 'type' property.\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Hoisting\n\n  \u003ca name=\"hoisting--about\"\u003e\u003c/a\u003e\u003ca name=\"14.1\"\u003e\u003c/a\u003e\n  - [14.1](#hoisting--about) `var` declarations get hoisted to the top of their closest enclosing function scope, their assignment does not. `const` and `let` declarations are blessed with a new concept called [Temporal Dead Zones (TDZ)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let#temporal_dead_zone_tdz). It’s important to know why [typeof is no longer safe](https://web.archive.org/web/20200121061528/http://es-discourse.com/t/why-typeof-is-no-longer-safe/15).\n\n    ```javascript\n    // we know this wouldn’t work (assuming there\n    // is no notDefined global variable)\n    function example() {\n      console.log(notDefined); // =\u003e throws a ReferenceError\n    }\n\n    // creating a variable declaration after you\n    // reference the variable will work due to\n    // variable hoisting. Note: the assignment\n    // value of `true` is not hoisted.\n    function example() {\n      console.log(declaredButNotAssigned); // =\u003e undefined\n      var declaredButNotAssigned = true;\n    }\n\n    // the interpreter is hoisting the variable\n    // declaration to the top of the scope,\n    // which means our example could be rewritten as:\n    function example() {\n      let declaredButNotAssigned;\n      console.log(declaredButNotAssigned); // =\u003e undefined\n      declaredButNotAssigned = true;\n    }\n\n    // using const and let\n    function example() {\n      console.log(declaredButNotAssigned); // =\u003e throws a ReferenceError\n      console.log(typeof declaredButNotAssigned); // =\u003e throws a ReferenceError\n      const declaredButNotAssigned = true;\n    }\n    ```\n\n  \u003ca name=\"hoisting--anon-expressions\"\u003e\u003c/a\u003e\u003ca name=\"14.2\"\u003e\u003c/a\u003e\n  - [14.2](#hoisting--anon-expressions) Anonymous function expressions hoist their variable name, but not the function assignment.\n\n    ```javascript\n    function example() {\n      console.log(anonymous); // =\u003e undefined\n\n      anonymous(); // =\u003e TypeError anonymous is not a function\n\n      var anonymous = function () {\n        console.log('anonymous function expression');\n      };\n    }\n    ```\n\n  \u003ca name=\"hoisting--named-expresions\"\u003e\u003c/a\u003e\u003ca name=\"hoisting--named-expressions\"\u003e\u003c/a\u003e\u003ca name=\"14.3\"\u003e\u003c/a\u003e\n  - [14.3](#hoisting--named-expressions) Named function expressions hoist the variable name, not the function name or the function body.\n\n    ```javascript\n    function example() {\n      console.log(named); // =\u003e undefined\n\n      named(); // =\u003e TypeError named is not a function\n\n      superPower(); // =\u003e ReferenceError superPower is not defined\n\n      var named = function superPower() {\n        console.log('Flying');\n      };\n    }\n\n    // the same is true when the function name\n    // is the same as the variable name.\n    function example() {\n      console.log(named); // =\u003e undefined\n\n      named(); // =\u003e TypeError named is not a function\n\n      var named = function named() {\n        console.log('named');\n      };\n    }\n    ```\n\n  \u003ca name=\"hoisting--declarations\"\u003e\u003c/a\u003e\u003ca name=\"14.4\"\u003e\u003c/a\u003e\n  - [14.4](#hoisting--declarations) Function declarations hoist their name and the function body.\n\n    ```javascript\n    function example() {\n      superPower(); // =\u003e Flying\n\n      function superPower() {\n        console.log('Flying');\n      }\n    }\n    ```\n\n  \u003ca name=\"no-use-before-define\"\u003e\u003c/a\u003e\n  - [14.5](#no-use-before-define) Variables, classes, and functions should be defined before they can be used. eslint: [`no-use-before-define`](https://eslint.org/docs/latest/rules/no-use-before-define)\n\n    \u003e Why? When variables, classes, or functions are declared after being used, it can harm readability since a reader won't know what a thing that's referenced is. It's much clearer for a reader to first encounter the source of a thing (whether imported from another module, or defined in the file) before encountering a use of the thing.\n\n    ```javascript\n    // bad\n\n    // Variable a is being used before it is being defined.\n    console.log(a); // this will be undefined, since while the declaration is hoisted, the initialization is not\n    var a = 10;\n\n    // Function fun is being called before being defined.\n    fun();\n    function fun() {}\n\n    // Class A is being used before being defined.\n    new A(); // ReferenceError: Cannot access 'A' before initialization\n    class A {\n    }\n\n    // `let` and `const` are hoisted, but they don't have a default initialization.\n    // The variables 'a' and 'b' are in a Temporal Dead Zone where JavaScript\n    // knows they exist (declaration is hoisted) but they are not accessible\n    // (as they are not yet initialized).\n\n    console.log(a); // ReferenceError: Cannot access 'a' before initialization\n    console.log(b); // ReferenceError: Cannot access 'b' before initialization\n    let a = 10;\n    const b = 5;\n\n\n    // good\n\n    var a = 10;\n    console.log(a); // 10\n\n    function fun() {}\n    fun();\n\n    class A {\n    }\n    new A();\n\n    let a = 10;\n    const b = 5;\n    console.log(a); // 10\n    console.log(b); // 5\n    ```\n\n  - For more information refer to [JavaScript Scoping \u0026 Hoisting](https://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting/) by [Ben Cherry](https://www.adequatelygood.com/).\n\n**[⬆ back to top](#table-of-contents)**\n\n## Comparison Operators \u0026 Equality\n\n  \u003ca name=\"comparison--eqeqeq\"\u003e\u003c/a\u003e\u003ca name=\"15.1\"\u003e\u003c/a\u003e\n  - [15.1](#comparison--eqeqeq) Use `===` and `!==` over `==` and `!=`. eslint: [`eqeqeq`](https://eslint.org/docs/rules/eqeqeq)\n\n  \u003ca name=\"comparison--if\"\u003e\u003c/a\u003e\u003ca name=\"15.2\"\u003e\u003c/a\u003e\n  - [15.2](#comparison--if) Conditional statements such as the `if` statement evaluate their expression using coercion with the `ToBoolean` abstract method and always follow these simple rules:\n\n    - **Objects** evaluate to **true**\n    - **Undefined** evaluates to **false**\n    - **Null** evaluates to **false**\n    - **Booleans** evaluate to **the value of the boolean**\n    - **Numbers** evaluate to **false** if **+0, -0, or NaN**, otherwise **true**\n    - **Strings** evaluate to **false** if an empty string `''`, otherwise **true**\n\n    ```javascript\n    if ([0] \u0026\u0026 []) {\n      // true\n      // an array (even an empty one) is an object, objects will evaluate to true\n    }\n    ```\n\n  \u003ca name=\"comparison--shortcuts\"\u003e\u003c/a\u003e\u003ca name=\"15.3\"\u003e\u003c/a\u003e\n  - [15.3](#comparison--shortcuts) Use shortcuts for booleans, but explicit comparisons for strings and numbers.\n\n    ```javascript\n    // bad\n    if (isValid === true) {\n      // ...\n    }\n\n    // good\n    if (isValid) {\n      // ...\n    }\n\n    // bad\n    if (name) {\n      // ...\n    }\n\n    // good\n    if (name !== '') {\n      // ...\n    }\n\n    // bad\n    if (collection.length) {\n      // ...\n    }\n\n    // good\n    if (collection.length \u003e 0) {\n      // ...\n    }\n    ```\n\n  \u003ca name=\"comparison--moreinfo\"\u003e\u003c/a\u003e\u003ca name=\"15.4\"\u003e\u003c/a\u003e\n  - [15.4](#comparison--moreinfo) For more information see [Truth, Equality, and JavaScript](https://javascriptweblog.wordpress.com/2011/02/07/truth-equality-and-javascript/#more-2108) by Angus Croll.\n\n  \u003ca name=\"comparison--switch-blocks\"\u003e\u003c/a\u003e\u003ca name=\"15.5\"\u003e\u003c/a\u003e\n  - [15.5](#comparison--switch-blocks) Use braces to create blocks in `case` and `default` clauses that contain lexical declarations (e.g. `let`, `const`, `function`, and `class`). eslint: [`no-case-declarations`](https://eslint.org/docs/rules/no-case-declarations)\n\n    \u003e Why? Lexical declarations are visible in the entire `switch` block but only get initialized when assigned, which only happens when its `case` is reached. This causes problems when multiple `case` clauses attempt to define the same thing.\n\n    ```javascript\n    // bad\n    switch (foo) {\n      case 1:\n        let x = 1;\n        break;\n      case 2:\n        const y = 2;\n        break;\n      case 3:\n        function f() {\n          // ...\n        }\n        break;\n      default:\n        class C {}\n    }\n\n    // good\n    switch (foo) {\n      case 1: {\n        let x = 1;\n        break;\n      }\n      case 2: {\n        const y = 2;\n        break;\n      }\n      case 3: {\n        function f() {\n          // ...\n        }\n        break;\n      }\n      case 4:\n        bar();\n        break;\n      default: {\n        class C {}\n      }\n    }\n    ```\n\n  \u003ca name=\"comparison--nested-ternaries\"\u003e\u003c/a\u003e\u003ca name=\"15.6\"\u003e\u003c/a\u003e\n  - [15.6](#comparison--nested-ternaries) Ternaries should not be nested and generally be single line expressions. eslint: [`no-nested-ternary`](https://eslint.org/docs/rules/no-nested-ternary)\n\n    ```javascript\n    // bad\n    const foo = maybe1 \u003e maybe2\n      ? \"bar\"\n      : value1 \u003e value2 ? \"baz\" : null;\n\n    // split into 2 separated ternary expressions\n    const maybeNull = value1 \u003e value2 ? 'baz' : null;\n\n    // better\n    const foo = maybe1 \u003e maybe2\n      ? 'bar'\n      : maybeNull;\n\n    // best\n    const foo = maybe1 \u003e maybe2 ? 'bar' : maybeNull;\n    ```\n\n  \u003ca name=\"comparison--unneeded-ternary\"\u003e\u003c/a\u003e\u003ca name=\"15.7\"\u003e\u003c/a\u003e\n  - [15.7](#comparison--unneeded-ternary) Avoid unneeded ternary statements. eslint: [`no-unneeded-ternary`](https://eslint.org/docs/rules/no-unneeded-ternary)\n\n    ```javascript\n    // bad\n    const foo = a ? a : b;\n    const bar = c ? true : false;\n    const baz = c ? false : true;\n    const quux = a != null ? a : b;\n\n    // good\n    const foo = a || b;\n    const bar = !!c;\n    const baz = !c;\n    const quux = a ?? b;\n    ```\n\n  \u003ca name=\"comparison--no-mixed-operators\"\u003e\u003c/a\u003e\n  - [15.8](#comparison--no-mixed-operators) When mixing operators, enclose them in parentheses. The only exception is the standard arithmetic operators: `+`, `-`, and `**` since their precedence is broadly understood. We recommend enclosing `/` and `*` in parentheses because their precedence can be ambiguous when they are mixed.\n  eslint: [`no-mixed-operators`](https://eslint.org/docs/rules/no-mixed-operators)\n\n    \u003e Why? This improves readability and clarifies the developer’s intention.\n\n    ```javascript\n    // bad\n    const foo = a \u0026\u0026 b \u003c 0 || c \u003e 0 || d + 1 === 0;\n\n    // bad\n    const bar = a ** b - 5 % d;\n\n    // bad\n    // one may be confused into thinking (a || b) \u0026\u0026 c\n    if (a || b \u0026\u0026 c) {\n      return d;\n    }\n\n    // bad\n    const bar = a + b / c * d;\n\n    // good\n    const foo = (a \u0026\u0026 b \u003c 0) || c \u003e 0 || (d + 1 === 0);\n\n    // good\n    const bar = a ** b - (5 % d);\n\n    // good\n    if (a || (b \u0026\u0026 c)) {\n      return d;\n    }\n\n    // good\n    const bar = a + (b / c) * d;\n    ```\n\n  \u003ca name=\"nullish-coalescing-operator\"\u003e\u003c/a\u003e\n  - [15.9](#nullish-coalescing-operator) The nullish coalescing operator (`??`) is a logical operator that returns its right-hand side operand when its left-hand side operand is `null` or `undefined`. Otherwise, it returns the left-hand side operand.\n\n    \u003e Why? It provides precision by distinguishing null/undefined from other falsy values, enhancing code clarity and predictability.\n\n    ```javascript\n    // bad\n    const value = 0 ?? 'default';\n    // returns 0, not 'default'\n\n    // bad\n    const value = '' ?? 'default';\n    // returns '', not 'default'\n\n    // good\n    const value = null ?? 'default';\n    // returns 'default'\n\n    // good\n    const user = {\n      name: 'John',\n      age: null\n    };\n    const age = user.age ?? 18;\n    // returns 18\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Blocks\n\n  \u003ca name=\"blocks--braces\"\u003e\u003c/a\u003e\u003ca name=\"16.1\"\u003e\u003c/a\u003e\n  - [16.1](#blocks--braces) Use braces with all multiline blocks. eslint: [`nonblock-statement-body-position`](https://eslint.org/docs/rules/nonblock-statement-body-position)\n\n    ```javascript\n    // bad\n    if (test)\n      return false;\n\n    // good\n    if (test) return false;\n\n    // good\n    if (test) {\n      return false;\n    }\n\n    // bad\n    function foo() { return false; }\n\n    // good\n    function bar() {\n      return false;\n    }\n    ```\n\n  \u003ca name=\"blocks--cuddled-elses\"\u003e\u003c/a\u003e\u003ca name=\"16.2\"\u003e\u003c/a\u003e\n  - [16.2](#blocks--cuddled-elses) If you’re using multiline blocks with `if` and `else`, put `else` on the same line as your `if` block’s closing brace. eslint: [`brace-style`](https://eslint.org/docs/rules/brace-style)\n\n    ```javascript\n    // bad\n    if (test) {\n      thing1();\n      thing2();\n    }\n    else {\n      thing3();\n    }\n\n    // good\n    if (test) {\n      thing1();\n      thing2();\n    } else {\n      thing3();\n    }\n    ```\n\n  \u003ca name=\"blocks--no-else-return\"\u003e\u003c/a\u003e\u003ca name=\"16.3\"\u003e\u003c/a\u003e\n  - [16.3](#blocks--no-else-return) If an `if` block always executes a `return` statement, the subsequent `else` block is unnecessary. A `return` in an `else if` block following an `if` block that contains a `return` can be separated into multiple `if` blocks. eslint: [`no-else-return`](https://eslint.org/docs/rules/no-else-return)\n\n    ```javascript\n    // bad\n    function foo() {\n      if (x) {\n        return x;\n      } else {\n        return y;\n      }\n    }\n\n    // bad\n    function cats() {\n      if (x) {\n        return x;\n      } else if (y) {\n        return y;\n      }\n    }\n\n    // bad\n    function dogs() {\n      if (x) {\n        return x;\n      } else {\n        if (y) {\n          return y;\n        }\n      }\n    }\n\n    // good\n    function foo() {\n      if (x) {\n        return x;\n      }\n\n      return y;\n    }\n\n    // good\n    function cats() {\n      if (x) {\n        return x;\n      }\n\n      if (y) {\n        return y;\n      }\n    }\n\n    // good\n    function dogs(x) {\n      if (x) {\n        if (z) {\n          return y;\n        }\n      } else {\n        return z;\n      }\n    }\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Control Statements\n\n  \u003ca name=\"control-statements\"\u003e\u003c/a\u003e\n  - [17.1](#control-statements) In case your control statement (`if`, `while` etc.) gets too long or exceeds the maximum line length, each (grouped) condition could be put into a new line. The logical operator should begin the line.\n\n    \u003e Why? Requiring operators at the beginning of the line keeps the operators aligned and follows a pattern similar to method chaining. This also improves readability by making it easier to visually follow complex logic.\n\n    ```javascript\n    // bad\n    if ((foo === 123 || bar === 'abc') \u0026\u0026 doesItLookGoodWhenItBecomesThatLong() \u0026\u0026 isThisReallyHappening()) {\n      thing1();\n    }\n\n    // bad\n    if (foo === 123 \u0026\u0026\n      bar === 'abc') {\n      thing1();\n    }\n\n    // bad\n    if (foo === 123\n      \u0026\u0026 bar === 'abc') {\n      thing1();\n    }\n\n    // bad\n    if (\n      foo === 123 \u0026\u0026\n      bar === 'abc'\n    ) {\n      thing1();\n    }\n\n    // good\n    if (\n      foo === 123\n      \u0026\u0026 bar === 'abc'\n    ) {\n      thing1();\n    }\n\n    // good\n    if (\n      (foo === 123 || bar === 'abc')\n      \u0026\u0026 doesItLookGoodWhenItBecomesThatLong()\n      \u0026\u0026 isThisReallyHappening()\n    ) {\n      thing1();\n    }\n\n    // good\n    if (foo === 123 \u0026\u0026 bar === 'abc') {\n      thing1();\n    }\n    ```\n\n  \u003ca name=\"control-statement--value-selection\"\u003e\u003c/a\u003e\u003ca name=\"control-statements--value-selection\"\u003e\u003c/a\u003e\n  - [17.2](#control-statements--value-selection) Don't use selection operators in place of control statements.\n\n    ```javascript\n    // bad\n    !isRunning \u0026\u0026 startRunning();\n\n    // good\n    if (!isRunning) {\n      startRunning();\n    }\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Comments\n\n  \u003ca name=\"comments--multiline\"\u003e\u003c/a\u003e\u003ca name=\"17.1\"\u003e\u003c/a\u003e\n  - [18.1](#comments--multiline) Use `/** ... */` for multiline comments.\n\n    ```javascript\n    // bad\n    // make() returns a new element\n    // based on the passed in tag name\n    //\n    // @param {String} tag\n    // @return {Element} element\n    function make(tag) {\n\n      // ...\n\n      return element;\n    }\n\n    // good\n    /**\n     * make() returns a new element\n     * based on the passed-in tag name\n     */\n    function make(tag) {\n\n      // ...\n\n      return element;\n    }\n    ```\n\n  \u003ca name=\"comments--singleline\"\u003e\u003c/a\u003e\u003ca name=\"17.2\"\u003e\u003c/a\u003e\n  - [18.2](#comments--singleline) Use `//` for single line comments. Place single line comments on a newline above the subject of the comment. Put an empty line before the comment unless it’s on the first line of a block.\n\n    ```javascript\n    // bad\n    const active = true;  // is current tab\n\n    // good\n    // is current tab\n    const active = true;\n\n    // bad\n    function getType() {\n      console.log('fetching type...');\n      // set the default type to 'no type'\n      const type = this.type || 'no type';\n\n      return type;\n    }\n\n    // good\n    function getType() {\n      console.log('fetching type...');\n\n      // set the default type to 'no type'\n      const type = this.type || 'no type';\n\n      return type;\n    }\n\n    // also good\n    function getType() {\n      // set the default type to 'no type'\n      const type = this.type || 'no type';\n\n      return type;\n    }\n    ```\n\n  \u003ca name=\"comments--spaces\"\u003e\u003c/a\u003e\n  - [18.3](#comments--spaces) Start all comments with a space to make it easier to read. eslint: [`spaced-comment`](https://eslint.org/docs/rules/spaced-comment)\n\n    ```javascript\n    // bad\n    //is current tab\n    const active = true;\n\n    // good\n    // is current tab\n    const active = true;\n\n    // bad\n    /**\n     *make() returns a new element\n     *based on the passed-in tag name\n     */\n    function make(tag) {\n\n      // ...\n\n      return element;\n    }\n\n    // good\n    /**\n     * make() returns a new element\n     * based on the passed-in tag name\n     */\n    function make(tag) {\n\n      // ...\n\n      return element;\n    }\n    ```\n\n  \u003ca name=\"comments--actionitems\"\u003e\u003c/a\u003e\u003ca name=\"17.3\"\u003e\u003c/a\u003e\n  - [18.4](#comments--actionitems) Prefixing your comments with `FIXME` or `TODO` helps other developers quickly understand if you’re pointing out a problem that needs to be revisited, or if you’re suggesting a solution to the problem that needs to be implemented. These are different than regular comments because they are actionable. The actions are `FIXME: -- need to figure this out` or `TODO: -- need to implement`.\n\n  \u003ca name=\"comments--fixme\"\u003e\u003c/a\u003e\u003ca name=\"17.4\"\u003e\u003c/a\u003e\n  - [18.5](#comments--fixme) Use `// FIXME:` to annotate problems.\n\n    ```javascript\n    class Calculator extends Abacus {\n      constructor() {\n        super();\n\n        // FIXME: shouldn’t use a global here\n        total = 0;\n      }\n    }\n    ```\n\n  \u003ca name=\"comments--todo\"\u003e\u003c/a\u003e\u003ca name=\"17.5\"\u003e\u003c/a\u003e\n  - [18.6](#comments--todo) Use `// TODO:` to annotate solutions to problems.\n\n    ```javascript\n    class Calculator extends Abacus {\n      constructor() {\n        super();\n\n        // TODO: total should be configurable by an options param\n        this.total = 0;\n      }\n    }\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Whitespace\n\n  \u003ca name=\"whitespace--spaces\"\u003e\u003c/a\u003e\u003ca name=\"18.1\"\u003e\u003c/a\u003e\n  - [19.1](#whitespace--spaces) Use soft tabs (space character) set to 2 spaces. eslint: [`indent`](https://eslint.org/docs/rules/indent)\n\n    ```javascript\n    // bad\n    function foo() {\n    ∙∙∙∙let name;\n    }\n\n    // bad\n    function bar() {\n    ∙let name;\n    }\n\n    // good\n    function baz() {\n    ∙∙let name;\n    }\n    ```\n\n  \u003ca name=\"whitespace--before-blocks\"\u003e\u003c/a\u003e\u003ca name=\"18.2\"\u003e\u003c/a\u003e\n  - [19.2](#whitespace--before-blocks) Place 1 space before the leading brace. eslint: [`space-before-blocks`](https://eslint.org/docs/rules/space-before-blocks)\n\n    ```javascript\n    // bad\n    function test(){\n      console.log('test');\n    }\n\n    // good\n    function test() {\n      console.log('test');\n    }\n\n    // bad\n    dog.set('attr',{\n      age: '1 year',\n      breed: 'Bernese Mountain Dog',\n    });\n\n    // good\n    dog.set('attr', {\n      age: '1 year',\n      breed: 'Bernese Mountain Dog',\n    });\n    ```\n\n  \u003ca name=\"whitespace--around-keywords\"\u003e\u003c/a\u003e\u003ca name=\"18.3\"\u003e\u003c/a\u003e\n  - [19.3](#whitespace--around-keywords) Place 1 space before the opening parenthesis in control statements (`if`, `while` etc.). Place no space between the argument list and the function name in function calls and declarations. eslint: [`keyword-spacing`](https://eslint.org/docs/rules/keyword-spacing)\n\n    ```javascript\n    // bad\n    if(isJedi) {\n      fight ();\n    }\n\n    // good\n    if (isJedi) {\n      fight();\n    }\n\n    // bad\n    function fight () {\n      console.log ('Swooosh!');\n    }\n\n    // good\n    function fight() {\n      console.log('Swooosh!');\n    }\n    ```\n\n  \u003ca name=\"whitespace--infix-ops\"\u003e\u003c/a\u003e\u003ca name=\"18.4\"\u003e\u003c/a\u003e\n  - [19.4](#whitespace--infix-ops) Set off operators with spaces. eslint: [`space-infix-ops`](https://eslint.org/docs/rules/space-infix-ops)\n\n    ```javascript\n    // bad\n    const x=y+5;\n\n    // good\n    const x = y + 5;\n    ```\n\n  \u003ca name=\"whitespace--newline-at-end\"\u003e\u003c/a\u003e\u003ca name=\"18.5\"\u003e\u003c/a\u003e\n  - [19.5](#whitespace--newline-at-end) End files with a single newline character. eslint: [`eol-last`](https://eslint.org/docs/rules/eol-last)\n\n    ```javascript\n    // bad\n    import { es6 } from './AirbnbStyleGuide';\n      // ...\n    export default es6;\n    ```\n\n    ```javascript\n    // bad\n    import { es6 } from './AirbnbStyleGuide';\n      // ...\n    export default es6;↵\n    ↵\n    ```\n\n    ```javascript\n    // good\n    import { es6 } from './AirbnbStyleGuide';\n      // ...\n    export default es6;↵\n    ```\n\n  \u003ca name=\"whitespace--chains\"\u003e\u003c/a\u003e\u003ca name=\"18.6\"\u003e\u003c/a\u003e\n  - [19.6](#whitespace--chains) Use indentation when making long method chains (more than 2 method chains). Use a leading dot, which\n    emphasizes that the line is a method call, not a new statement. eslint: [`newline-per-chained-call`](https://eslint.org/docs/rules/newline-per-chained-call) [`no-whitespace-before-property`](https://eslint.org/docs/rules/no-whitespace-before-property)\n\n    ```javascript\n    // bad\n    $('#items').find('.selected').highlight().end().find('.open').updateCount();\n\n    // bad\n    $('#items').\n      find('.selected').\n        highlight().\n        end().\n      find('.open').\n        updateCount();\n\n    // good\n    $('#items')\n      .find('.selected')\n        .highlight()\n        .end()\n      .find('.open')\n        .updateCount();\n\n    // bad\n    const leds = stage.selectAll('.led').data(data).enter().append('svg:svg').classed('led', true)\n        .attr('width', (radius + margin) * 2).append('svg:g')\n        .attr('transform', `translate(${radius + margin}, ${radius + margin})`)\n        .call(tron.led);\n\n    // good\n    const leds = stage.selectAll('.led')\n        .data(data)\n      .enter().append('svg:svg')\n        .classed('led', true)\n        .attr('width', (radius + margin) * 2)\n      .append('svg:g')\n        .attr('transform', `translate(${radius + margin}, ${radius + margin})`)\n        .call(tron.led);\n\n    // good\n    const leds = stage.selectAll('.led').data(data);\n    const svg = leds.enter().append('svg:svg');\n    svg.classed('led', true).attr('width', (radius + margin) * 2);\n    const g = svg.append('svg:g');\n    g.attr('transform', `translate(${radius + margin}, ${radius + margin})`).call(tron.led);\n    ```\n\n  \u003ca name=\"whitespace--after-blocks\"\u003e\u003c/a\u003e\u003ca name=\"18.7\"\u003e\u003c/a\u003e\n  - [19.7](#whitespace--after-blocks) Leave a blank line after blocks and before the next statement.\n\n    ```javascript\n    // bad\n    if (foo) {\n      return bar;\n    }\n    return baz;\n\n    // good\n    if (foo) {\n      return bar;\n    }\n\n    return baz;\n\n    // bad\n    const obj = {\n      foo() {\n      },\n      bar() {\n      },\n    };\n    return obj;\n\n    // good\n    const obj = {\n      foo() {\n      },\n\n      bar() {\n      },\n    };\n\n    return obj;\n\n    // bad\n    const arr = [\n      function foo() {\n      },\n      function bar() {\n      },\n    ];\n    return arr;\n\n    // good\n    const arr = [\n      function foo() {\n      },\n\n      function bar() {\n      },\n    ];\n\n    return arr;\n    ```\n\n  \u003ca name=\"whitespace--padded-blocks\"\u003e\u003c/a\u003e\u003ca name=\"18.8\"\u003e\u003c/a\u003e\n  - [19.8](#whitespace--padded-blocks) Do not pad your blocks with blank lines. eslint: [`padded-blocks`](https://eslint.org/docs/rules/padded-blocks)\n\n    ```javascript\n    // bad\n    function bar() {\n\n      console.log(foo);\n\n    }\n\n    // bad\n    if (baz) {\n\n      console.log(quux);\n    } else {\n      console.log(foo);\n\n    }\n\n    // bad\n    class Foo {\n\n      constructor(bar) {\n        this.bar = bar;\n      }\n    }\n\n    // good\n    function bar() {\n      console.log(foo);\n    }\n\n    // good\n    if (baz) {\n      console.log(quux);\n    } else {\n      console.log(foo);\n    }\n    ```\n\n  \u003ca name=\"whitespace--no-multiple-blanks\"\u003e\u003c/a\u003e\n  - [19.9](#whitespace--no-multiple-blanks) Do not use multiple blank lines to pad your code. eslint: [`no-multiple-empty-lines`](https://eslint.org/docs/rules/no-multiple-empty-lines)\n\n    \u003c!-- markdownlint-disable MD012 --\u003e\n    ```javascript\n    // bad\n    class Person {\n      constructor(fullName, email, birthday) {\n        this.fullName = fullName;\n\n\n        this.email = email;\n\n\n        this.setAge(birthday);\n      }\n\n\n      setAge(birthday) {\n        const today = new Date();\n\n\n        const age = this.getAge(today, birthday);\n\n\n        this.age = age;\n      }\n\n\n      getAge(today, birthday) {\n        // ..\n      }\n    }\n\n    // good\n    class Person {\n      constructor(fullName, email, birthday) {\n        this.fullName = fullName;\n        this.email = email;\n        this.setAge(birthday);\n      }\n\n      setAge(birthday) {\n        const today = new Date();\n        const age = getAge(today, birthday);\n        this.age = age;\n      }\n\n      getAge(today, birthday) {\n        // ..\n      }\n    }\n    ```\n\n  \u003ca name=\"whitespace--in-parens\"\u003e\u003c/a\u003e\u003ca name=\"18.9\"\u003e\u003c/a\u003e\n  - [19.10](#whitespace--in-parens) Do not add spaces inside parentheses. eslint: [`space-in-parens`](https://eslint.org/docs/rules/space-in-parens)\n\n    ```javascript\n    // bad\n    function bar( foo ) {\n      return foo;\n    }\n\n    // good\n    function bar(foo) {\n      return foo;\n    }\n\n    // bad\n    if ( foo ) {\n      console.log(foo);\n    }\n\n    // good\n    if (foo) {\n      console.log(foo);\n    }\n    ```\n\n  \u003ca name=\"whitespace--in-brackets\"\u003e\u003c/a\u003e\u003ca name=\"18.10\"\u003e\u003c/a\u003e\n  - [19.11](#whitespace--in-brackets) Do not add spaces inside brackets. eslint: [`array-bracket-spacing`](https://eslint.org/docs/rules/array-bracket-spacing)\n\n    ```javascript\n    // bad\n    const foo = [ 1, 2, 3 ];\n    console.log(foo[ 0 ]);\n\n    // good\n    const foo = [1, 2, 3];\n    console.log(foo[0]);\n    ```\n\n  \u003ca name=\"whitespace--in-braces\"\u003e\u003c/a\u003e\u003ca name=\"18.11\"\u003e\u003c/a\u003e\n  - [19.12](#whitespace--in-braces) Add spaces inside curly braces. eslint: [`object-curly-spacing`](https://eslint.org/docs/rules/object-curly-spacing)\n\n    ```javascript\n    // bad\n    const foo = {clark: 'kent'};\n\n    // good\n    const foo = { clark: 'kent' };\n    ```\n\n  \u003ca name=\"whitespace--max-len\"\u003e\u003c/a\u003e\u003ca name=\"18.12\"\u003e\u003c/a\u003e\n  - [19.13](#whitespace--max-len) Avoid having lines of code that are longer than 100 characters (including whitespace). Note: per [above](#strings--line-length), long strings are exempt from this rule, and should not be broken up. eslint: [`max-len`](https://eslint.org/docs/rules/max-len)\n\n    \u003e Why? This ensures readability and maintainability.\n\n    ```javascript\n    // bad\n    const foo = jsonData \u0026\u0026 jsonData.foo \u0026\u0026 jsonData.foo.bar \u0026\u0026 jsonData.foo.bar.baz \u0026\u0026 jsonData.foo.bar.baz.quux \u0026\u0026 jsonData.foo.bar.baz.quux.xyzzy;\n\n    // bad\n    $.ajax({ method: 'POST', url: 'https://airbnb.com/', data: { name: 'John' } }).done(() =\u003e console.log('Congratulations!')).fail(() =\u003e console.log('You have failed this city.'));\n\n    // good\n    const foo = jsonData\n      \u0026\u0026 jsonData.foo\n      \u0026\u0026 jsonData.foo.bar\n      \u0026\u0026 jsonData.foo.bar.baz\n      \u0026\u0026 jsonData.foo.bar.baz.quux\n      \u0026\u0026 jsonData.foo.bar.baz.quux.xyzzy;\n\n    // better\n    const foo = jsonData\n      ?.foo\n      ?.bar\n      ?.baz\n      ?.quux\n      ?.xyzzy;\n\n    // good\n    $.ajax({\n      method: 'POST',\n      url: 'https://airbnb.com/',\n      data: { name: 'John' },\n    })\n      .done(() =\u003e console.log('Congratulations!'))\n      .fail(() =\u003e console.log('You have failed this city.'));\n    ```\n\n  \u003ca name=\"whitespace--block-spacing\"\u003e\u003c/a\u003e\n  - [19.14](#whitespace--block-spacing) Require consistent spacing inside an open block token and the next token on the same line. This rule also enforces consistent spacing inside a close block token and previous token on the same line. eslint: [`block-spacing`](https://eslint.org/docs/rules/block-spacing)\n\n    ```javascript\n    // bad\n    function foo() {return true;}\n    if (foo) { bar = 0;}\n\n    // good\n    function foo() { return true; }\n    if (foo) { bar = 0; }\n    ```\n\n  \u003ca name=\"whitespace--comma-spacing\"\u003e\u003c/a\u003e\n  - [19.15](#whitespace--comma-spacing) Avoid spaces before commas and require a space after commas. eslint: [`comma-spacing`](https://eslint.org/docs/rules/comma-spacing)\n\n    ```javascript\n    // bad\n    const foo = 1,bar = 2;\n    const arr = [1 , 2];\n\n    // good\n    const foo = 1, bar = 2;\n    const arr = [1, 2];\n    ```\n\n  \u003ca name=\"whitespace--computed-property-spacing\"\u003e\u003c/a\u003e\n  - [19.16](#whitespace--computed-property-spacing) Enforce spacing inside of computed property brackets. eslint: [`computed-property-spacing`](https://eslint.org/docs/rules/computed-property-spacing)\n\n    ```javascript\n    // bad\n    obj[foo ]\n    obj[ 'foo']\n    const x = {[ b ]: a}\n    obj[foo[ bar ]]\n\n    // good\n    obj[foo]\n    obj['foo']\n    const x = { [b]: a }\n    obj[foo[bar]]\n    ```\n\n  \u003ca name=\"whitespace--func-call-spacing\"\u003e\u003c/a\u003e\n  - [19.17](#whitespace--func-call-spacing) Avoid spaces between functions and their invocations. eslint: [`func-call-spacing`](https://eslint.org/docs/rules/func-call-spacing)\n\n    ```javascript\n    // bad\n    func ();\n\n    func\n    ();\n\n    // good\n    func();\n    ```\n\n  \u003ca name=\"whitespace--key-spacing\"\u003e\u003c/a\u003e\n  - [19.18](#whitespace--key-spacing) Enforce spacing between keys and values in object literal properties. eslint: [`key-spacing`](https://eslint.org/docs/rules/key-spacing)\n\n    ```javascript\n    // bad\n    const obj = { foo : 42 };\n    const obj2 = { foo:42 };\n\n    // good\n    const obj = { foo: 42 };\n    ```\n\n  \u003ca name=\"whitespace--no-trailing-spaces\"\u003e\u003c/a\u003e\n  - [19.19](#whitespace--no-trailing-spaces) Avoid trailing spaces at the end of lines. eslint: [`no-trailing-spaces`](https://eslint.org/docs/rules/no-trailing-spaces)\n\n  \u003ca name=\"whitespace--no-multiple-empty-lines\"\u003e\u003c/a\u003e\n  - [19.20](#whitespace--no-multiple-empty-lines) Avoid multiple empty lines, only allow one newline at the end of files, and avoid a newline at the beginning of files. eslint: [`no-multiple-empty-lines`](https://eslint.org/docs/rules/no-multiple-empty-lines)\n\n    \u003c!-- markdownlint-disable MD012 --\u003e\n    ```javascript\n    // bad - multiple empty lines\n    const x = 1;\n\n\n    const y = 2;\n\n    // bad - 2+ newlines at end of file\n    const x = 1;\n    const y = 2;\n\n\n    // bad - 1+ newline(s) at beginning of file\n\n    const x = 1;\n    const y = 2;\n\n    // good\n    const x = 1;\n    const y = 2;\n\n    ```\n    \u003c!-- markdownlint-enable MD012 --\u003e\n\n**[⬆ back to top](#table-of-contents)**\n\n## Commas\n\n  \u003ca name=\"commas--leading-trailing\"\u003e\u003c/a\u003e\u003ca name=\"19.1\"\u003e\u003c/a\u003e\n  - [20.1](#commas--leading-trailing) Leading commas: **Nope.** eslint: [`comma-style`](https://eslint.org/docs/rules/comma-style)\n\n    ```javascript\n    // bad\n    const story = [\n        once\n      , upon\n      , aTime\n    ];\n\n    // good\n    const story = [\n      once,\n      upon,\n      aTime,\n    ];\n\n    // bad\n    const hero = {\n        firstName: 'Ada'\n      , lastName: 'Lovelace'\n      , birthYear: 1815\n      , superPower: 'computers'\n    };\n\n    // good\n    const hero = {\n      firstName: 'Ada',\n      lastName: 'Lovelace',\n      birthYear: 1815,\n      superPower: 'computers',\n    };\n    ```\n\n  \u003ca name=\"commas--dangling\"\u003e\u003c/a\u003e\u003ca name=\"19.2\"\u003e\u003c/a\u003e\n  - [20.2](#commas--dangling) Additional trailing comma: **Yup.** eslint: [`comma-dangle`](https://eslint.org/docs/rules/comma-dangle)\n\n    \u003e Why? This leads to cleaner git diffs. Also, transpilers like Babel will remove the additional trailing comma in the transpiled code which means you don’t have to worry about the [trailing comma problem](https://github.com/airbnb/javascript/blob/es5-deprecated/es5/README.md#commas) in legacy browsers.\n\n    ```diff\n    // bad - git diff without trailing comma\n    const hero = {\n         firstName: 'Florence',\n    -    lastName: 'Nightingale'\n    +    lastName: 'Nightingale',\n    +    inventorOf: ['coxcomb chart', 'modern nursing']\n    };\n\n    // good - git diff with trailing comma\n    const hero = {\n         firstName: 'Florence',\n         lastName: 'Nightingale',\n    +    inventorOf: ['coxcomb chart', 'modern nursing'],\n    };\n    ```\n\n    ```javascript\n    // bad\n    const hero = {\n      firstName: 'Dana',\n      lastName: 'Scully'\n    };\n\n    const heroes = [\n      'Batman',\n      'Superman'\n    ];\n\n    // good\n    const hero = {\n      firstName: 'Dana',\n      lastName: 'Scully',\n    };\n\n    const heroes = [\n      'Batman',\n      'Superman',\n    ];\n\n    // bad\n    function createHero(\n      firstName,\n      lastName,\n      inventorOf\n    ) {\n      // does nothing\n    }\n\n    // good\n    function createHero(\n      firstName,\n      lastName,\n      inventorOf,\n    ) {\n      // does nothing\n    }\n\n    // good (note that a comma must not appear after a \"rest\" element)\n    function createHero(\n      firstName,\n      lastName,\n      inventorOf,\n      ...heroArgs\n    ) {\n      // does nothing\n    }\n\n    // bad\n    createHero(\n      firstName,\n      lastName,\n      inventorOf\n    );\n\n    // good\n    createHero(\n      firstName,\n      lastName,\n      inventorOf,\n    );\n\n    // good (note that a comma must not appear after a \"rest\" element)\n    createHero(\n      firstName,\n      lastName,\n      inventorOf,\n      ...heroArgs\n    );\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Semicolons\n\n  \u003ca name=\"semicolons--required\"\u003e\u003c/a\u003e\u003ca name=\"20.1\"\u003e\u003c/a\u003e\n  - [21.1](#semicolons--required) **Yup.** eslint: [`semi`](https://eslint.org/docs/rules/semi)\n\n    \u003e Why? When JavaScript encounters a line break without a semicolon, it uses a set of rules called [Automatic Semicolon Insertion](https://tc39.github.io/ecma262/#sec-automatic-semicolon-insertion) to determine whether it should regard that line break as the end of a statement, and (as the name implies) place a semicolon into your code before the line break if it thinks so. ASI contains a few eccentric behaviors, though, and your code will break if JavaScript misinterprets your line break. These rules will become more complicated as new features become a part of JavaScript. Explicitly terminating your statements and configuring your linter to catch missing semicolons will help prevent you from encountering issues.\n\n    ```javascript\n    // bad - raises exception\n    const luke = {}\n    const leia = {}\n    [luke, leia].forEach((jedi) =\u003e jedi.father = 'vader')\n\n    // bad - raises exception\n    const reaction = \"No! That’s impossible!\"\n    (async function meanwhileOnTheFalcon() {\n      // handle `leia`, `lando`, `chewie`, `r2`, `c3p0`\n      // ...\n    }())\n\n    // bad - returns `undefined` instead of the value on the next line - always happens when `return` is on a line by itself because of ASI!\n    function foo() {\n      return\n        'search your feelings, you know it to be foo'\n    }\n\n    // good\n    const luke = {};\n    const leia = {};\n    [luke, leia].forEach((jedi) =\u003e {\n      jedi.father = 'vader';\n    });\n\n    // good\n    const reaction = 'No! That’s impossible!';\n    (async function meanwhileOnTheFalcon() {\n      // handle `leia`, `lando`, `chewie`, `r2`, `c3p0`\n      // ...\n    }());\n\n    // good\n    function foo() {\n      return 'search your feelings, you know it to be foo';\n    }\n    ```\n\n    [Read more](https://stackoverflow.com/questions/7365172/semicolon-before-self-invoking-function/7365214#7365214).\n\n**[⬆ back to top](#table-of-contents)**\n\n## Type Casting \u0026 Coercion\n\n  \u003ca name=\"coercion--explicit\"\u003e\u003c/a\u003e\u003ca name=\"21.1\"\u003e\u003c/a\u003e\n  - [22.1](#coercion--explicit) Perform type coercion at the beginning of the statement.\n\n  \u003ca name=\"coercion--strings\"\u003e\u003c/a\u003e\u003ca name=\"21.2\"\u003e\u003c/a\u003e\n  - [22.2](#coercion--strings) Strings: eslint: [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers)\n\n    ```javascript\n    // =\u003e this.reviewScore = 9;\n\n    // bad\n    const totalScore = new String(this.reviewScore); // typeof totalScore is \"object\" not \"string\"\n\n    // bad\n    const totalScore = this.reviewScore + ''; // invokes this.reviewScore.valueOf()\n\n    // bad\n    const totalScore = this.reviewScore.toString(); // isn’t guaranteed to return a string\n\n    // good\n    const totalScore = String(this.reviewScore);\n    ```\n\n  \u003ca name=\"coercion--numbers\"\u003e\u003c/a\u003e\u003ca name=\"21.3\"\u003e\u003c/a\u003e\n  - [22.3](#coercion--numbers) Numbers: Use `Number` for type casting and `parseInt` always with a radix for parsing strings. eslint: [`radix`](https://eslint.org/docs/rules/radix) [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers)\n\n    \u003e Why? The `parseInt` function produces an integer value dictated by interpretation of the contents of the string argument according to the specified radix. Leading whitespace in string is ignored. If radix is `undefined` or `0`, it is assumed to be `10` except when the number begins with the character pairs `0x` or `0X`, in which case a radix of 16 is assumed. This differs from ECMAScript 3, which merely discouraged (but allowed) octal interpretation. Many implementations have not adopted this behavior as of 2013. And, because older browsers must be supported, always specify a radix.\n\n    ```javascript\n    const inputValue = '4';\n\n    // bad\n    const val = new Number(inputValue);\n\n    // bad\n    const val = +inputValue;\n\n    // bad\n    const val = inputValue \u003e\u003e 0;\n\n    // bad\n    const val = parseInt(inputValue);\n\n    // good\n    const val = Number(inputValue);\n\n    // good\n    const val = parseInt(inputValue, 10);\n    ```\n\n  \u003ca name=\"coercion--comment-deviations\"\u003e\u003c/a\u003e\u003ca name=\"21.4\"\u003e\u003c/a\u003e\n  - [22.4](#coercion--comment-deviations) If for whatever reason you are doing something wild and `parseInt` is your bottleneck and need to use Bitshift for [performance reasons](https://web.archive.org/web/20200414205431/https://jsperf.com/coercion-vs-casting/3), leave a comment explaining why and what you’re doing.\n\n    ```javascript\n    // good\n    /**\n     * parseInt was the reason my code was slow.\n     * Bitshifting the String to coerce it to a\n     * Number made it a lot faster.\n     */\n    const val = inputValue \u003e\u003e 0;\n    ```\n\n  \u003ca name=\"coercion--bitwise\"\u003e\u003c/a\u003e\u003ca name=\"21.5\"\u003e\u003c/a\u003e\n  - [22.5](#coercion--bitwise) **Note:** Be careful when using bitshift operations. Numbers are represented as [64-bit values](https://es5.github.io/#x4.3.19), but bitshift operations always return a 32-bit integer ([source](https://es5.github.io/#x11.7)). Bitshift can lead to unexpected behavior for integer values larger than 32 bits. [Discussion](https://github.com/airbnb/javascript/issues/109). Largest signed 32-bit Int is 2,147,483,647:\n\n    ```javascript\n    2147483647 \u003e\u003e 0; // =\u003e 2147483647\n    2147483648 \u003e\u003e 0; // =\u003e -2147483648\n    2147483649 \u003e\u003e 0; // =\u003e -2147483647\n    ```\n\n  \u003ca name=\"coercion--booleans\"\u003e\u003c/a\u003e\u003ca name=\"21.6\"\u003e\u003c/a\u003e\n  - [22.6](#coercion--booleans) Booleans: eslint: [`no-new-wrappers`](https://eslint.org/docs/rules/no-new-wrappers)\n\n    ```javascript\n    const age = 0;\n\n    // bad\n    const hasAge = new Boolean(age);\n\n    // good\n    const hasAge = Boolean(age);\n\n    // best\n    const hasAge = !!age;\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Naming Conventions\n\n  \u003ca name=\"naming--descriptive\"\u003e\u003c/a\u003e\u003ca name=\"22.1\"\u003e\u003c/a\u003e\n  - [23.1](#naming--descriptive) Avoid single letter names. Be descriptive with your naming. eslint: [`id-length`](https://eslint.org/docs/rules/id-length)\n\n    ```javascript\n    // bad\n    function q() {\n      // ...\n    }\n\n    // good\n    function query() {\n      // ...\n    }\n    ```\n\n  \u003ca name=\"naming--camelCase\"\u003e\u003c/a\u003e\u003ca name=\"22.2\"\u003e\u003c/a\u003e\n  - [23.2](#naming--camelCase) Use camelCase when naming objects, functions, and instances. eslint: [`camelcase`](https://eslint.org/docs/rules/camelcase)\n\n    ```javascript\n    // bad\n    const OBJEcttsssss = {};\n    const this_is_my_object = {};\n    function c() {}\n\n    // good\n    const thisIsMyObject = {};\n    function thisIsMyFunction() {}\n    ```\n\n  \u003ca name=\"naming--PascalCase\"\u003e\u003c/a\u003e\u003ca name=\"22.3\"\u003e\u003c/a\u003e\n  - [23.3](#naming--PascalCase) Use PascalCase only when naming constructors or classes. eslint: [`new-cap`](https://eslint.org/docs/rules/new-cap)\n\n    ```javascript\n    // bad\n    function user(options) {\n      this.name = options.name;\n    }\n\n    const bad = new user({\n      name: 'nope',\n    });\n\n    // good\n    class User {\n      constructor(options) {\n        this.name = options.name;\n      }\n    }\n\n    const good = new User({\n      name: 'yup',\n    });\n    ```\n\n  \u003ca name=\"naming--leading-underscore\"\u003e\u003c/a\u003e\u003ca name=\"22.4\"\u003e\u003c/a\u003e\n  - [23.4](#naming--leading-underscore) Do not use trailing or leading underscores. eslint: [`no-underscore-dangle`](https://eslint.org/docs/rules/no-underscore-dangle)\n\n    \u003e Why? JavaScript does not have the concept of privacy in terms of properties or methods. Although a leading underscore is a common convention to mean “private”, in fact, these properties are fully public, and as such, are part of your public API contract. This convention might lead developers to wrongly think that a change won’t count as breaking, or that tests aren’t needed. tl;dr: if you want something to be “private”, it must not be observably present.\n\n    ```javascript\n    // bad\n    this.__firstName__ = 'Panda';\n    this.firstName_ = 'Panda';\n    this._firstName = 'Panda';\n\n    // good\n    this.firstName = 'Panda';\n\n    // good, in environments where WeakMaps are available\n    // see https://compat-table.github.io/compat-table/es6/#test-WeakMap\n    const firstNames = new WeakMap();\n    firstNames.set(this, 'Panda');\n    ```\n\n  \u003ca name=\"naming--self-this\"\u003e\u003c/a\u003e\u003ca name=\"22.5\"\u003e\u003c/a\u003e\n  - [23.5](#naming--self-this) Don’t save references to `this`. Use arrow functions or [Function#bind](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).\n\n    ```javascript\n    // bad\n    function foo() {\n      const self = this;\n      return function () {\n        console.log(self);\n      };\n    }\n\n    // bad\n    function foo() {\n      const that = this;\n      return function () {\n        console.log(that);\n      };\n    }\n\n    // good\n    function foo() {\n      return () =\u003e {\n        console.log(this);\n      };\n    }\n    ```\n\n  \u003ca name=\"naming--filename-matches-export\"\u003e\u003c/a\u003e\u003ca name=\"22.6\"\u003e\u003c/a\u003e\n  - [23.6](#naming--filename-matches-export) A base filename should exactly match the name of its default export.\n\n    ```javascript\n    // file 1 contents\n    class CheckBox {\n      // ...\n    }\n    export default CheckBox;\n\n    // file 2 contents\n    export default function fortyTwo() { return 42; }\n\n    // file 3 contents\n    export default function insideDirectory() {}\n\n    // in some other file\n    // bad\n    import CheckBox from './checkBox'; // PascalCase import/export, camelCase filename\n    import FortyTwo from './FortyTwo'; // PascalCase import/filename, camelCase export\n    import InsideDirectory from './InsideDirectory'; // PascalCase import/filename, camelCase export\n\n    // bad\n    import CheckBox from './check_box'; // PascalCase import/export, snake_case filename\n    import forty_two from './forty_two'; // snake_case import/filename, camelCase export\n    import inside_directory from './inside_directory'; // snake_case import, camelCase export\n    import index from './inside_directory/index'; // requiring the index file explicitly\n    import insideDirectory from './insideDirectory/index'; // requiring the index file explicitly\n\n    // good\n    import CheckBox from './CheckBox'; // PascalCase export/import/filename\n    import fortyTwo from './fortyTwo'; // camelCase export/import/filename\n    import insideDirectory from './insideDirectory'; // camelCase export/import/directory name/implicit \"index\"\n    // ^ supports both insideDirectory.js and insideDirectory/index.js\n    ```\n\n  \u003ca name=\"naming--camelCase-default-export\"\u003e\u003c/a\u003e\u003ca name=\"22.7\"\u003e\u003c/a\u003e\n  - [23.7](#naming--camelCase-default-export) Use camelCase when you export-default a function. Your filename should be identical to your function’s name.\n\n    ```javascript\n    function makeStyleGuide() {\n      // ...\n    }\n\n    export default makeStyleGuide;\n    ```\n\n  \u003ca name=\"naming--PascalCase-singleton\"\u003e\u003c/a\u003e\u003ca name=\"22.8\"\u003e\u003c/a\u003e\n  - [23.8](#naming--PascalCase-singleton) Use PascalCase when you export a constructor / class / singleton / function library / bare object.\n\n    ```javascript\n    const AirbnbStyleGuide = {\n      es6: {\n      },\n    };\n\n    export default AirbnbStyleGuide;\n    ```\n\n  \u003ca name=\"naming--Acronyms-and-Initialisms\"\u003e\u003c/a\u003e\n  - [23.9](#naming--Acronyms-and-Initialisms) Acronyms and initialisms should always be all uppercased, or all lowercased.\n\n    \u003e Why? Names are for readability, not to appease a computer algorithm.\n\n    ```javascript\n    // bad\n    import SmsContainer from './containers/SmsContainer';\n\n    // bad\n    const HttpRequests = [\n      // ...\n    ];\n\n    // good\n    import SMSContainer from './containers/SMSContainer';\n\n    // good\n    const HTTPRequests = [\n      // ...\n    ];\n\n    // also good\n    const httpRequests = [\n      // ...\n    ];\n\n    // best\n    import TextMessageContainer from './containers/TextMessageContainer';\n\n    // best\n    const requests = [\n      // ...\n    ];\n    ```\n\n  \u003ca name=\"naming--uppercase\"\u003e\u003c/a\u003e\n  - [23.10](#naming--uppercase) You may optionally uppercase a constant only if it (1) is exported, (2) is a `const` (it can not be reassigned), and (3) the programmer can trust it (and its nested properties) to never change.\n\n    \u003e Why? This is an additional tool to assist in situations where the programmer would be unsure if a variable might ever change. UPPERCASE_VARIABLES are letting the programmer know that they can trust the variable (and its properties) not to change.\n    - What about all `const` variables? - This is unnecessary, so uppercasing should not be used for constants within a file. It should be used for exported constants however.\n    - What about exported objects? - Uppercase at the top level of export (e.g. `EXPORTED_OBJECT.key`) and maintain that all nested properties do not change.\n\n    ```javascript\n    // bad\n    const PRIVATE_VARIABLE = 'should not be unnecessarily uppercased within a file';\n\n    // bad\n    export const THING_TO_BE_CHANGED = 'should obviously not be uppercased';\n\n    // bad\n    export let REASSIGNABLE_VARIABLE = 'do not use let with uppercase variables';\n\n    // ---\n\n    // allowed but does not supply semantic value\n    export const apiKey = 'SOMEKEY';\n\n    // better in most cases\n    export const API_KEY = 'SOMEKEY';\n\n    // ---\n\n    // bad - unnecessarily uppercases key while adding no semantic value\n    export const MAPPING = {\n      KEY: 'value'\n    };\n\n    // good\n    export const MAPPING = {\n      key: 'value',\n    };\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Accessors\n\n  \u003ca name=\"accessors--not-required\"\u003e\u003c/a\u003e\u003ca name=\"23.1\"\u003e\u003c/a\u003e\n  - [24.1](#accessors--not-required) Accessor functions for properties are not required.\n\n  \u003ca name=\"accessors--no-getters-setters\"\u003e\u003c/a\u003e\u003ca name=\"23.2\"\u003e\u003c/a\u003e\n  - [24.2](#accessors--no-getters-setters) Do not use JavaScript getters/setters as they cause unexpected side effects and are harder to test, maintain, and reason about. Instead, if you do make accessor functions, use `getVal()` and `setVal('hello')`.\n\n    ```javascript\n    // bad\n    class Dragon {\n      get age() {\n        // ...\n      }\n\n      set age(value) {\n        // ...\n      }\n    }\n\n    // good\n    class Dragon {\n      getAge() {\n        // ...\n      }\n\n      setAge(value) {\n        // ...\n      }\n    }\n    ```\n\n  \u003ca name=\"accessors--boolean-prefix\"\u003e\u003c/a\u003e\u003ca name=\"23.3\"\u003e\u003c/a\u003e\n  - [24.3](#accessors--boolean-prefix) If the property/method is a `boolean`, use `isVal()` or `hasVal()`.\n\n    ```javascript\n    // bad\n    if (!dragon.age()) {\n      return false;\n    }\n\n    // good\n    if (!dragon.hasAge()) {\n      return false;\n    }\n    ```\n\n  \u003ca name=\"accessors--consistent\"\u003e\u003c/a\u003e\u003ca name=\"23.4\"\u003e\u003c/a\u003e\n  - [24.4](#accessors--consistent) It’s okay to create `get()` and `set()` functions, but be consistent.\n\n    ```javascript\n    class Jedi {\n      constructor(options = {}) {\n        const lightsaber = options.lightsaber || 'blue';\n        this.set('lightsaber', lightsaber);\n      }\n\n      set(key, val) {\n        this[key] = val;\n      }\n\n      get(key) {\n        return this[key];\n      }\n    }\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Events\n\n  \u003ca name=\"events--hash\"\u003e\u003c/a\u003e\u003ca name=\"24.1\"\u003e\u003c/a\u003e\n  - [25.1](#events--hash) When attaching data payloads to events (whether DOM events or something more proprietary like Backbone events), pass an object literal (also known as a \"hash\") instead of a raw value. This allows a subsequent contributor to add more data to the event payload without finding and updating every handler for the event. For example, instead of:\n\n    ```javascript\n    // bad\n    $(this).trigger('listingUpdated', listing.id);\n\n    // ...\n\n    $(this).on('listingUpdated', (e, listingID) =\u003e {\n      // do something with listingID\n    });\n    ```\n\n    prefer:\n\n    ```javascript\n    // good\n    $(this).trigger('listingUpdated', { listingID: listing.id });\n\n    // ...\n\n    $(this).on('listingUpdated', (e, data) =\u003e {\n      // do something with data.listingID\n    });\n    ```\n\n  **[⬆ back to top](#table-of-contents)**\n\n## jQuery\n\n  \u003ca name=\"jquery--dollar-prefix\"\u003e\u003c/a\u003e\u003ca name=\"25.1\"\u003e\u003c/a\u003e\n  - [26.1](#jquery--dollar-prefix) Prefix jQuery object variables with a `$`.\n\n    ```javascript\n    // bad\n    const sidebar = $('.sidebar');\n\n    // good\n    const $sidebar = $('.sidebar');\n\n    // good\n    const $sidebarBtn = $('.sidebar-btn');\n    ```\n\n  \u003ca name=\"jquery--cache\"\u003e\u003c/a\u003e\u003ca name=\"25.2\"\u003e\u003c/a\u003e\n  - [26.2](#jquery--cache) Cache jQuery lookups.\n\n    ```javascript\n    // bad\n    function setSidebar() {\n      $('.sidebar').hide();\n\n      // ...\n\n      $('.sidebar').css({\n        'background-color': 'pink',\n      });\n    }\n\n    // good\n    function setSidebar() {\n      const $sidebar = $('.sidebar');\n      $sidebar.hide();\n\n      // ...\n\n      $sidebar.css({\n        'background-color': 'pink',\n      });\n    }\n    ```\n\n  \u003ca name=\"jquery--queries\"\u003e\u003c/a\u003e\u003ca name=\"25.3\"\u003e\u003c/a\u003e\n  - [26.3](#jquery--queries) For DOM queries use Cascading `$('.sidebar ul')` or parent \u003e child `$('.sidebar \u003e ul')`. [jsPerf](https://web.archive.org/web/20200414183810/https://jsperf.com/jquery-find-vs-context-sel/16)\n\n  \u003ca name=\"jquery--find\"\u003e\u003c/a\u003e\u003ca name=\"25.4\"\u003e\u003c/a\u003e\n  - [26.4](#jquery--find) Use `find` with scoped jQuery object queries.\n\n    ```javascript\n    // bad\n    $('ul', '.sidebar').hide();\n\n    // bad\n    $('.sidebar').find('ul').hide();\n\n    // good\n    $('.sidebar ul').hide();\n\n    // good\n    $('.sidebar \u003e ul').hide();\n\n    // good\n    $sidebar.find('ul').hide();\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## ECMAScript 5 Compatibility\n\n  \u003ca name=\"es5-compat--kangax\"\u003e\u003c/a\u003e\u003ca name=\"26.1\"\u003e\u003c/a\u003e\n  - [27.1](#es5-compat--kangax) Refer to [Kangax](https://twitter.com/kangax/)’s ES5 [compatibility table](https://compat-table.github.io/compat-table/es5/).\n\n**[⬆ back to top](#table-of-contents)**\n\n\u003ca name=\"ecmascript-6-styles\"\u003e\u003c/a\u003e\n## ECMAScript 6+ (ES 2015+) Styles\n\n  \u003ca name=\"es6-styles\"\u003e\u003c/a\u003e\u003ca name=\"27.1\"\u003e\u003c/a\u003e\n  - [28.1](#es6-styles) This is a collection of links to the various ES6+ features.\n\n1. [Arrow Functions](#arrow-functions)\n1. [Classes](#classes--constructors)\n1. [Object Shorthand](#es6-object-shorthand)\n1. [Object Concise](#es6-object-concise)\n1. [Object Computed Properties](#es6-computed-properties)\n1. [Template Strings](#es6-template-literals)\n1. [Destructuring](#destructuring)\n1. [Default Parameters](#es6-default-parameters)\n1. [Rest](#es6-rest)\n1. [Array Spreads](#es6-array-spreads)\n1. [Let and Const](#references)\n1. [Exponentiation Operator](#es2016-properties--exponentiation-operator)\n1. [Iterators and Generators](#iterators-and-generators)\n1. [Modules](#modules)\n\n  \u003ca name=\"tc39-proposals\"\u003e\u003c/a\u003e\n  - [28.2](#tc39-proposals) Do not use [TC39 proposals](https://github.com/tc39/proposals) that have not reached stage 3.\n\n    \u003e Why? [They are not finalized](https://tc39.github.io/process-document/), and they are subject to change or to be withdrawn entirely. We want to use JavaScript, and proposals are not JavaScript yet.\n\n**[⬆ back to top](#table-of-contents)**\n\n## Standard Library\n\n  The [Standard Library](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects)\n  contains utilities that are functionally broken but remain for legacy reasons.\n\n  \u003ca name=\"standard-library--isnan\"\u003e\u003c/a\u003e\n  - [29.1](#standard-library--isnan) Use `Number.isNaN` instead of global `isNaN`.\n    eslint: [`no-restricted-globals`](https://eslint.org/docs/rules/no-restricted-globals)\n\n    \u003e Why? The global `isNaN` coerces non-numbers to numbers, returning true for anything that coerces to NaN.\n    \u003e If this behavior is desired, make it explicit.\n\n    ```javascript\n    // bad\n    isNaN('1.2'); // false\n    isNaN('1.2.3'); // true\n\n    // good\n    Number.isNaN('1.2.3'); // false\n    Number.isNaN(Number('1.2.3')); // true\n    ```\n\n  \u003ca name=\"standard-library--isfinite\"\u003e\u003c/a\u003e\n  - [29.2](#standard-library--isfinite) Use `Number.isFinite` instead of global `isFinite`.\n    eslint: [`no-restricted-globals`](https://eslint.org/docs/rules/no-restricted-globals)\n\n    \u003e Why? The global `isFinite` coerces non-numbers to numbers, returning true for anything that coerces to a finite number.\n    \u003e If this behavior is desired, make it explicit.\n\n    ```javascript\n    // bad\n    isFinite('2e3'); // true\n\n    // good\n    Number.isFinite('2e3'); // false\n    Number.isFinite(parseInt('2e3', 10)); // true\n    ```\n\n**[⬆ back to top](#table-of-contents)**\n\n## Testing\n\n  \u003ca name=\"testing--yup\"\u003e\u003c/a\u003e\u003ca name=\"28.1\"\u003e\u003c/a\u003e\n  - [30.1](#testing--yup) **Yup.**\n\n    ```javascript\n    function foo() {\n      return true;\n    }\n    ```\n\n  \u003ca name=\"testing--for-real\"\u003e\u003c/a\u003e\u003ca name=\"28.2\"\u003e\u003c/a\u003e\n  - [30.2](#testing--for-real) **No, but seriously**:\n    - Whichever testing framework you use, you should be writing tests!\n    - Strive to write many small pure functions, and minimize where mutations occur.\n    - Be cautious about stubs and mocks - they can make your tests more brittle.\n    - We primarily use [`mocha`](https://www.npmjs.com/package/mocha) and [`jest`](https://www.npmjs.com/package/jest) at Airbnb. [`tape`](https://www.npmjs.com/package/tape) is also used occasionally for small, separate modules.\n    - 100% test coverage is a good goal to strive for, even if it’s not always practical to reach it.\n    - Whenever you fix a bug, *write a regression test*. A bug fixed without a regression test is almost certainly going to break again in the future.\n\n**[⬆ back to top](#table-of-contents)**\n\n## Performance\n\n  - [On Layout \u0026 Web Performance](https://www.kellegous.com/j/2013/01/26/layout-performance/)\n  - [String vs Array Concat](https://web.archive.org/web/20200414200857/https://jsperf.com/string-vs-array-concat/2)\n  - [Try/Catch Cost In a Loop](https://web.archive.org/web/20200414190827/https://jsperf.com/try-catch-in-loop-cost/12)\n  - [Bang Function](https://web.archive.org/web/20200414205426/https://jsperf.com/bang-function)\n  - [jQuery Find vs Context, Selector](https://web.archive.org/web/20200414200850/https://jsperf.com/jquery-find-vs-context-sel/164)\n  - [innerHTML vs textContent for script text](https://web.archive.org/web/20200414205428/https://jsperf.com/innerhtml-vs-textcontent-for-script-text)\n  - [Long String Concatenation](https://web.archive.org/web/20200414203914/https://jsperf.com/ya-string-concat/38)\n  - [Are JavaScript functions like `map()`, `reduce()`, and `filter()` optimized for traversing arrays?](https://www.quora.com/JavaScript-programming-language-Are-Javascript-functions-like-map-reduce-and-filter-already-optimized-for-traversing-array/answer/Quildreen-Motta)\n  - Loading...\n\n**[⬆ back to top](#table-of-contents)**\n\n## Resources\n\n**Learning ES6+**\n\n  - [Latest ECMA spec](https://tc39.github.io/ecma262/)\n  - [ExploringJS](https://exploringjs.com/)\n  - [ES6 Compatibility Table](https://compat-table.github.io/compat-table/es6/)\n  - [Comprehensive Overview of ES6 Features](https://web.archive.org/web/20240404212626/http://es6-features.org/)\n  - [JavaScript Roadmap](https://roadmap.sh/javascript)\n\n**Read This**\n\n  - [Standard ECMA-262](https://www.ecma-international.org/ecma-262/6.0/index.html)\n\n**Tools**\n\n  - Code Style Linters\n    - [ESlint](https://eslint.org/) - [Airbnb Style .eslintrc](https://github.com/airbnb/javascript/blob/master/linters/.eslintrc)\n    - [JSHint](https://jshint.com/) - [Airbnb Style .jshintrc](https://github.com/airbnb/javascript/blob/master/linters/.jshintrc)\n  - Neutrino Preset - [@neutrinojs/airbnb](https://neutrinojs.org/packages/airbnb/)\n\n**Other Style Guides**\n\n  - [Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html)\n  - [Google JavaScript Style Guide (Old)](https://google.github.io/styleguide/javascriptguide.xml)\n  - [jQuery Core Style Guidelines](https://contribute.jquery.org/style-guide/js/)\n  - [Principles of Writing Consistent, Idiomatic JavaScript](https://github.com/rwaldron/idiomatic.js)\n  - [StandardJS](https://standardjs.com)\n\n**Other Styles**\n\n  - [Naming this in nested functions](https://gist.github.com/cjohansen/4135065) - Christian Johansen\n  - [Conditional Callbacks](https://github.com/airbnb/javascript/issues/52) - Ross Allen\n  - [Popular JavaScript Coding Conventions on GitHub](http://sideeffect.kr/popularconvention/#javascript) - JeongHoon Byun\n  - [Multiple var statements in JavaScript, not superfluous](https://benalman.com/news/2012/05/multiple-var-statements-javascript/) - Ben Alman\n\n**Further Reading**\n\n  - [Understanding JavaScript Closures](https://javascriptweblog.wordpress.com/2010/10/25/understanding-javascript-closures/) - Angus Croll\n  - [Basic JavaScript for the impatient programmer](https://www.2ality.com/2013/06/basic-javascript.html) - Dr. Axel Rauschmayer\n  - [You Might Not Need jQuery](https://youmightnotneedjquery.com/) - Zack Bloom \u0026 Adam Schwartz\n  - [ES6 Features](https://github.com/lukehoban/es6features) - Luke Hoban\n  - [Frontend Guidelines](https://github.com/bendc/frontend-guidelines) - Benjamin De Cock\n\n**Books**\n\n  - [JavaScript: The Good Parts](https://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742) - Douglas Crockford\n  - [JavaScript Patterns](https://www.amazon.com/JavaScript-Patterns-Stoyan-Stefanov/dp/0596806752) - Stoyan Stefanov\n  - [Pro JavaScript Design Patterns](https://www.amazon.com/JavaScript-Design-Patterns-Recipes-Problem-Solution/dp/159059908X) - Ross Harmes and Dustin Diaz\n  - [High Performance Web Sites: Essential Knowledge for Front-End Engineers](https://www.amazon.com/High-Performance-Web-Sites-Essential/dp/0596529309) - Steve Souders\n  - [Maintainable JavaScript](https://www.amazon.com/Maintainable-JavaScript-Nicholas-C-Zakas/dp/1449327680) - Nicholas C. Zakas\n  - [JavaScript Web Applications](https://www.amazon.com/JavaScript-Web-Applications-Alex-MacCaw/dp/144930351X) - Alex MacCaw\n  - [Pro JavaScript Techniques](https://www.amazon.com/Pro-JavaScript-Techniques-John-Resig/dp/1590597273) - John Resig\n  - [Smashing Node.js: JavaScript Everywhere](https://www.amazon.com/Smashing-Node-js-JavaScript-Everywhere-Magazine/dp/1119962595) - Guillermo Rauch\n  - [Secrets of the JavaScript Ninja](https://www.amazon.com/Secrets-JavaScript-Ninja-John-Resig/dp/193398869X) - John Resig and Bear Bibeault\n  - [Human JavaScript](http://humanjavascript.com/) - Henrik Joreteg\n  - [Superhero.js](http://superherojs.com/) - Kim Joar Bekkelund, Mads Mobæk, \u0026 Olav Bjorkoy\n  - [JSBooks](https://jsbooks.revolunet.com/) - Julien Bouquillon\n  - [Third Party JavaScript](https://www.manning.com/books/third-party-javascript) - Ben Vinegar and Anton Kovalyov\n  - [Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript](https://amzn.com/dp/0321812182) - David Herman\n  - [Eloquent JavaScript](https://eloquentjavascript.net/) - Marijn Haverbeke\n  - [You Don’t Know JS: ES6 \u0026 Beyond](https://shop.oreilly.com/product/0636920033769.do) - Kyle Simpson\n\n**Blogs**\n\n  - [JavaScript Weekly](https://javascriptweekly.com/)\n  - [JavaScript, JavaScript...](https://javascriptweblog.wordpress.com/)\n  - [Bocoup Weblog](https://bocoup.com/weblog)\n  - [Adequately Good](https://www.adequatelygood.com/)\n  - [NCZOnline](https://www.nczonline.net/)\n  - [Perfection Kills](http://perfectionkills.com/)\n  - [Ben Alman](https://benalman.com/)\n  - [Dmitry Baranovskiy](http://dmitry.baranovskiy.com/)\n  - [nettuts](https://code.tutsplus.com/?s=javascript)\n\n**Podcasts**\n\n  - [JavaScript Air](https://javascriptair.com/)\n  - [JavaScript Jabber](https://devchat.tv/js-jabber/)\n\n**[⬆ back to top](#table-of-contents)**\n\n## In the Wild\n\n  This is a list of organizations that are using this style guide. Send us a pull request and we'll add you to the list.\n\n  - **123erfasst**: [123erfasst/javascript](https://github.com/123erfasst/javascript)\n  - **4Catalyzer**: [4Catalyzer/javascript](https://github.com/4Catalyzer/javascript)\n  - **Aan Zee**: [AanZee/javascript](https://github.com/AanZee/javascript)\n  - **Airbnb**: [airbnb/javascript](https://github.com/airbnb/javascript)\n  - **AloPeyk**: [AloPeyk](https://github.com/AloPeyk)\n  - **AltSchool**: [AltSchool/javascript](https://github.com/AltSchool/javascript)\n  - **Apartmint**: [apartmint/javascript](https://github.com/apartmint/javascript)\n  - **Ascribe**: [ascribe/javascript](https://github.com/ascribe/javascript)\n  - **Avant**: [avantcredit/javascript](https://github.com/avantcredit/javascript)\n  - **Axept**: [axept/javascript](https://github.com/axept/javascript)\n  - **Billabong**: [billabong/javascript](https://github.com/billabong/javascript)\n  - **Bisk**: [bisk](https://github.com/Bisk/)\n  - **Brainshark**: [brainshark/javascript](https://github.com/brainshark/javascript)\n  - **CaseNine**: [CaseNine/javascript](https://github.com/CaseNine/javascript)\n  - **Cerner**: [Cerner](https://github.com/cerner/)\n  - **Chartboost**: [ChartBoost/javascript-style-guide](https://github.com/ChartBoost/javascript-style-guide)\n  - **Coeur d'Alene Tribe**: [www.cdatribe-nsn.gov](https://www.cdatribe-nsn.gov)\n  - **ComparaOnline**: [comparaonline/javascript](https://github.com/comparaonline/javascript-style-guide)\n  - **Compass Learning**: [compasslearning/javascript-style-guide](https://github.com/compasslearning/javascript-style-guide)\n  - **DailyMotion**: [dailymotion/javascript](https://github.com/dailymotion/javascript)\n  - **DoSomething**: [DoSomething/eslint-config](https://github.com/DoSomething/eslint-config)\n  - **Digitpaint** [digitpaint/javascript](https://github.com/digitpaint/javascript)\n  - **Drupal**: [www.drupal.org](https://git.drupalcode.org/project/drupal/blob/8.6.x/core/.eslintrc.json)\n  - **Ecosia**: [ecosia/javascript](https://github.com/ecosia/javascript)\n  - **Evolution Gaming**: [evolution-gaming/javascript](https://github.com/evolution-gaming/javascript)\n  - **EvozonJs**: [evozonjs/javascript](https://github.com/evozonjs/javascript)\n  - **ExactTarget**: [ExactTarget/javascript](https://github.com/ExactTarget/javascript)\n  - **Flexberry**: [Flexberry/javascript-style-guide](https://github.com/Flexberry/javascript-style-guide)\n  - **Gawker Media**: [gawkermedia](https://github.com/gawkermedia/)\n  - **General Electric**: [GeneralElectric/javascript](https://github.com/GeneralElectric/javascript)\n  - **Generation Tux**: [GenerationTux/javascript](https://github.com/generationtux/styleguide)\n  - **GoodData**: [gooddata/gdc-js-style](https://github.com/gooddata/gdc-js-style)\n  - **GreenChef**: [greenchef/javascript](https://github.com/greenchef/javascript)\n  - **Grooveshark**: [grooveshark/javascript](https://github.com/grooveshark/javascript)\n  - **Grupo-Abraxas**: [Grupo-Abraxas/javascript](https://github.com/Grupo-Abraxas/javascript)\n  - **Happeo**: [happeo/javascript](https://github.com/happeo/javascript)\n  - **How About We**: [howaboutwe/javascript](https://github.com/howaboutwe/javascript-style-guide)\n  - **HubSpot**: [HubSpot/javascript](https://github.com/HubSpot/javascript)\n  - **Hyper**: [hyperoslo/javascript-playbook](https://github.com/hyperoslo/javascript-playbook/blob/master/style.md)\n  - **ILIAS**: [ILIAS](https://github.com/ILIAS-eLearning/ILIAS)\n  - **InterCity Group**: [intercitygroup/javascript-style-guide](https://github.com/intercitygroup/javascript-style-guide)\n  - **Jam3**: [Jam3/Javascript-Code-Conventions](https://github.com/Jam3/Javascript-Code-Conventions)\n  - **JSSolutions**: [JSSolutions/javascript](https://github.com/JSSolutions/javascript)\n  - **Kaplan Komputing**: [kaplankomputing/javascript](https://github.com/kaplankomputing/javascript)\n  - **KickorStick**: [kickorstick](https://github.com/kickorstick/)\n  - **Kinetica Solutions**: [kinetica/javascript](https://github.com/kinetica/Javascript-style-guide)\n  - **LEINWAND**: [LEINWAND/javascript](https://github.com/LEINWAND/javascript)\n  - **Lonely Planet**: [lonelyplanet/javascript](https://github.com/lonelyplanet/javascript)\n  - **M2GEN**: [M2GEN/javascript](https://github.com/M2GEN/javascript)\n  - **Mighty Spring**: [mightyspring/javascript](https://github.com/mightyspring/javascript)\n  - **MinnPost**: [MinnPost/javascript](https://github.com/MinnPost/javascript)\n  - **MitocGroup**: [MitocGroup/javascript](https://github.com/MitocGroup/javascript)\n  - **Muber**: [muber](https://github.com/muber/)\n  - **National Geographic Society**: [natgeosociety](https://github.com/natgeosociety/)\n  - **NullDev**: [NullDevCo/JavaScript-Styleguide](https://github.com/NullDevCo/JavaScript-Styleguide)\n  - **Nulogy**: [nulogy/javascript](https://github.com/nulogy/javascript)\n  - **Orange Hill Development**: [orangehill/javascript](https://github.com/orangehill/javascript)\n  - **Orion Health**: [orionhealth/javascript](https://github.com/orionhealth/javascript)\n  - **Peerby**: [Peerby/javascript](https://github.com/Peerby/javascript)\n  - **Pier 1**: [Pier1/javascript](https://github.com/pier1/javascript)\n  - **Qotto**: [Qotto/javascript-style-guide](https://github.com/Qotto/javascript-style-guide)\n  - **React**: [reactjs.org/docs/how-to-contribute.html#style-guide](https://reactjs.org/docs/how-to-contribute.html#style-guide)\n  - **Ripple**: [ripple/javascript-style-guide](https://github.com/ripple/javascript-style-guide)\n  - **Sainsbury’s Supermarkets**: [jsainsburyplc](https://github.com/jsainsburyplc)\n  - **Shutterfly**: [shutterfly/javascript](https://github.com/shutterfly/javascript)\n  - **Sourcetoad**: [sourcetoad/javascript](https://github.com/sourcetoad/javascript)\n  - **Springload**: [springload](https://github.com/springload/)\n  - **StratoDem Analytics**: [stratodem/javascript](https://github.com/stratodem/javascript)\n  - **SteelKiwi Development**: [steelkiwi/javascript](https://github.com/steelkiwi/javascript)\n  - **StudentSphere**: [studentsphere/javascript](https://github.com/studentsphere/guide-javascript)\n  - **SwoopApp**: [swoopapp/javascript](https://github.com/swoopapp/javascript)\n  - **SysGarage**: [sysgarage/javascript-style-guide](https://github.com/sysgarage/javascript-style-guide)\n  - **Syzygy Warsaw**: [syzygypl/javascript](https://github.com/syzygypl/javascript)\n  - **Target**: [target/javascript](https://github.com/target/javascript)\n  - **Terra**: [terra](https://github.com/cerner?utf8=%E2%9C%93\u0026q=terra\u0026type=\u0026language=)\n  - **TheLadders**: [TheLadders/javascript](https://github.com/TheLadders/javascript)\n  - **The Nerdery**: [thenerdery/javascript-standards](https://github.com/thenerdery/javascript-standards)\n  - **Tomify**: [tomprats](https://github.com/tomprats)\n  - **Traitify**: [traitify/eslint-config-traitify](https://github.com/traitify/eslint-config-traitify)\n  - **T4R Technology**: [T4R-Technology/javascript](https://github.com/T4R-Technology/javascript)\n  - **UrbanSim**: [urbansim](https://github.com/urbansim/)\n  - **VoxFeed**: [VoxFeed/javascript-style-guide](https://github.com/VoxFeed/javascript-style-guide)\n  - **WeBox Studio**: [weboxstudio/javascript](https://github.com/weboxstudio/javascript)\n  - **Weggo**: [Weggo/javascript](https://github.com/Weggo/javascript)\n  - **Zillow**: [zillow/javascript](https://github.com/zillow/javascript)\n  - **Zit Software**: [zit-software/javascript](https://github.com/zit-software/javascript)\n  - **ZocDoc**: [ZocDoc/javascript](https://github.com/ZocDoc/javascript)\n\n**[⬆ back to top](#table-of-contents)**\n\n## Translation\n\n  This style guide is also available in other languages:\n\n  - ![br](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Brazil.png) **Brazilian Portuguese**: [armoucar/javascript-style-guide](https://github.com/armoucar/javascript-style-guide)\n  - ![bg](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Bulgaria.png) **Bulgarian**: [borislavvv/javascript](https://github.com/borislavvv/javascript)\n  - ![ca](https://raw.githubusercontent.com/fpmweb/javascript-style-guide/master/img/catala.png) **Catalan**: [fpmweb/javascript-style-guide](https://github.com/fpmweb/javascript-style-guide)\n  - ![cn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/China.png) **Chinese (Simplified)**: [lin-123/javascript](https://github.com/lin-123/javascript)\n  - ![tw](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Taiwan.png) **Chinese (Traditional)**: [jigsawye/javascript](https://github.com/jigsawye/javascript)\n  - ![fr](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/France.png) **French**: [nmussy/javascript-style-guide](https://github.com/nmussy/javascript-style-guide)\n  - ![de](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Germany.png) **German**: [timofurrer/javascript-style-guide](https://github.com/timofurrer/javascript-style-guide)\n  - ![it](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Italy.png) **Italian**: [sinkswim/javascript-style-guide](https://github.com/sinkswim/javascript-style-guide)\n  - ![jp](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Japan.png) **Japanese**: [mitsuruog/javascript-style-guide](https://github.com/mitsuruog/javascript-style-guide)\n  - ![kr](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/South-Korea.png) **Korean**: [ParkSB/javascript-style-guide](https://github.com/ParkSB/javascript-style-guide)\n  - ![ru](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Russia.png) **Russian**: [leonidlebedev/javascript-airbnb](https://github.com/leonidlebedev/javascript-airbnb)\n  - ![es](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Spain.png) **Spanish**: [paolocarrasco/javascript-style-guide](https://github.com/paolocarrasco/javascript-style-guide)\n  - ![th](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Thailand.png) **Thai**: [lvarayut/javascript-style-guide](https://github.com/lvarayut/javascript-style-guide)\n  - ![tr](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Turkey.png) **Turkish**: [eraycetinay/javascript](https://github.com/eraycetinay/javascript)\n  - ![ua](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Ukraine.png) **Ukrainian**: [ivanzusko/javascript](https://github.com/ivanzusko/javascript)\n  - ![vn](https://raw.githubusercontent.com/gosquared/flags/master/flags/flags/shiny/24/Vietnam.png) **Vietnam**: [dangkyokhoang/javascript-style-guide](https://github.com/dangkyokhoang/javascript-style-guide)\n\n## The JavaScript Style Guide Guide\n\n  - [Reference](https://github.com/airbnb/javascript/wiki/The-JavaScript-Style-Guide-Guide)\n\n## Chat With Us About JavaScript\n\n  - Find us on [gitter](https://gitter.im/airbnb/javascript).\n\n## Contributors\n\n  - [View Contributors](https://github.com/airbnb/javascript/graphs/contributors)\n\n## License\n\n(The MIT License)\n\nCopyright (c) 2012 Airbnb\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n**[⬆ back to top](#table-of-contents)**\n\n## Amendments\n\nWe encourage you to fork this guide and change the rules to fit your team’s style guide. Below, you may list some amendments to the style guide. This allows you to periodically update your style guide without having to deal with merge conflicts.\n\n# };\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrhrifat%2Fjavascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrhrifat%2Fjavascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrhrifat%2Fjavascript/lists"}