|
466 | 466 | console.log(foo[0], bar[0]); // => 9, 9
|
467 | 467 | ```
|
468 | 468 |
|
469 |
| -**[⬆ back to top](#table-of-contents)** |
| 469 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
470 | 470 |
|
471 | 471 | ## References
|
472 | 472 |
|
|
534 | 534 | console.log(c); // 1
|
535 | 535 | ```
|
536 | 536 |
|
537 |
| -**[⬆ back to top](#table-of-contents)** |
| 537 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
538 | 538 |
|
539 | 539 | ## Objects
|
540 | 540 |
|
|
708 | 708 | const { a, ...noA } = copy; // noA => { b: 2, c: 3 }
|
709 | 709 | ```
|
710 | 710 |
|
711 |
| -**[⬆ back to top](#table-of-contents)** |
| 711 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
712 | 712 |
|
713 | 713 | ## Arrays
|
714 | 714 |
|
|
871 | 871 | ];
|
872 | 872 | ```
|
873 | 873 |
|
874 |
| -**[⬆ back to top](#table-of-contents)** |
| 874 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
875 | 875 |
|
876 | 876 | ## Destructuring
|
877 | 877 |
|
|
940 | 940 | const { left, top } = processInput(input);
|
941 | 941 | ```
|
942 | 942 |
|
943 |
| -**[⬆ back to top](#table-of-contents)** |
| 943 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
944 | 944 |
|
945 | 945 | ## Strings
|
946 | 946 |
|
|
1051 | 1051 | const profileRegex = /http(?:s?):\/\/website\.com\/user\/(\w+)/gi
|
1052 | 1052 | ```
|
1053 | 1053 |
|
1054 |
| -**[⬆ back to top](#table-of-contents)** |
| 1054 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
1055 | 1055 |
|
1056 | 1056 | ## Functions
|
1057 | 1057 |
|
|
1386 | 1386 | );
|
1387 | 1387 | ```
|
1388 | 1388 |
|
1389 |
| -**[⬆ back to top](#table-of-contents)** |
| 1389 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
1390 | 1390 |
|
1391 | 1391 | ## Arrow Functions
|
1392 | 1392 |
|
|
1547 | 1547 | )
|
1548 | 1548 | ```
|
1549 | 1549 |
|
1550 |
| -**[⬆ back to top](#table-of-contents)** |
| 1550 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
1551 | 1551 |
|
1552 | 1552 | ## Classes & Constructors
|
1553 | 1553 |
|
|
1713 | 1713 | }
|
1714 | 1714 | ```
|
1715 | 1715 |
|
1716 |
| -**[⬆ back to top](#table-of-contents)** |
| 1716 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
1717 | 1717 |
|
1718 | 1718 | ## Modules
|
1719 | 1719 |
|
|
1925 | 1925 | };
|
1926 | 1926 | ```
|
1927 | 1927 |
|
1928 |
| -**[⬆ back to top](#table-of-contents)** |
| 1928 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
1929 | 1929 |
|
1930 | 1930 | ## Properties
|
1931 | 1931 |
|
|
1973 | 1973 | const binary = 2 ** 10;
|
1974 | 1974 | ```
|
1975 | 1975 |
|
1976 |
| -**[⬆ back to top](#table-of-contents)** |
| 1976 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
1977 | 1977 |
|
1978 | 1978 | ## Variables
|
1979 | 1979 |
|
|
2218 | 2218 | let y = Math.floor(x);
|
2219 | 2219 | ```
|
2220 | 2220 |
|
2221 |
| -**[⬆ back to top](#table-of-contents)** |
| 2221 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
2222 | 2222 |
|
2223 | 2223 | ## Hoisting
|
2224 | 2224 |
|
|
2317 | 2317 |
|
2318 | 2318 | - For more information refer to [JavaScript Scoping & Hoisting](http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting/) by [Ben Cherry](http://www.adequatelygood.com/).
|
2319 | 2319 |
|
2320 |
| -**[⬆ back to top](#table-of-contents)** |
| 2320 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
2321 | 2321 |
|
2322 | 2322 | ## Comparison Operators & Equality
|
2323 | 2323 |
|
|
2497 | 2497 | const bar = a + b / c * d;
|
2498 | 2498 | ```
|
2499 | 2499 |
|
2500 |
| -**[⬆ back to top](#table-of-contents)** |
| 2500 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
2501 | 2501 |
|
2502 | 2502 | ## Blocks
|
2503 | 2503 |
|
|
2620 | 2620 | }
|
2621 | 2621 | ```
|
2622 | 2622 |
|
2623 |
| -**[⬆ back to top](#table-of-contents)** |
| 2623 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
2624 | 2624 |
|
2625 | 2625 | ## Control Statements
|
2626 | 2626 |
|
|
2689 | 2689 | if (!isRunning) startRunning();
|
2690 | 2690 | ```
|
2691 | 2691 |
|
2692 |
| -**[⬆ back to top](#table-of-contents)** |
| 2692 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
2693 | 2693 |
|
2694 | 2694 | ## Comments
|
2695 | 2695 |
|
|
2839 | 2839 | }
|
2840 | 2840 | ```
|
2841 | 2841 |
|
2842 |
| -**[⬆ back to top](#table-of-contents)** |
| 2842 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
2843 | 2843 |
|
2844 | 2844 | ## Whitespace
|
2845 | 2845 |
|
|
3321 | 3321 | ```
|
3322 | 3322 | <!-- markdownlint-enable MD012 -->
|
3323 | 3323 |
|
3324 |
| -**[⬆ back to top](#table-of-contents)** |
| 3324 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
3325 | 3325 |
|
3326 | 3326 | ## Commas
|
3327 | 3327 |
|
|
3438 | 3438 | );
|
3439 | 3439 | ```
|
3440 | 3440 |
|
3441 |
| -**[⬆ back to top](#table-of-contents)** |
| 3441 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
3442 | 3442 |
|
3443 | 3443 | ## Semicolons
|
3444 | 3444 |
|
|
3487 | 3487 |
|
3488 | 3488 | [Read more](https://stackoverflow.com/questions/7365172/semicolon-before-self-invoking-function/7365214#7365214).
|
3489 | 3489 |
|
3490 |
| -**[⬆ back to top](#table-of-contents)** |
| 3490 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
3491 | 3491 |
|
3492 | 3492 | ## Type Casting & Coercion
|
3493 | 3493 |
|
|
3576 | 3576 | const hasAge = !!age;
|
3577 | 3577 | ```
|
3578 | 3578 |
|
3579 |
| -**[⬆ back to top](#table-of-contents)** |
| 3579 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
3580 | 3580 |
|
3581 | 3581 | ## Naming Conventions
|
3582 | 3582 |
|
|
3840 | 3840 | if (isActive) doSomething();
|
3841 | 3841 | ```
|
3842 | 3842 |
|
3843 |
| -**[⬆ back to top](#table-of-contents)** |
| 3843 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
3844 | 3844 |
|
3845 | 3845 | ## Accessors
|
3846 | 3846 |
|
|
3909 | 3909 | }
|
3910 | 3910 | ```
|
3911 | 3911 |
|
3912 |
| -**[⬆ back to top](#table-of-contents)** |
| 3912 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
3913 | 3913 |
|
3914 | 3914 | ## Events
|
3915 | 3915 |
|
|
3942 | 3942 | });
|
3943 | 3943 | ```
|
3944 | 3944 |
|
3945 |
| - **[⬆ back to top](#table-of-contents)** |
| 3945 | + **[⬆ back to top](#table-of-contents-bookmark_tabs)** |
3946 | 3946 |
|
3947 | 3947 | ## Standard Library
|
3948 | 3948 |
|
|
3982 | 3982 | Number.isFinite(parseInt("2e3", 10)); // true
|
3983 | 3983 | ```
|
3984 | 3984 |
|
3985 |
| -**[⬆ back to top](#table-of-contents)** |
| 3985 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
3986 | 3986 |
|
3987 | 3987 | ## jQuery
|
3988 | 3988 |
|
|
4118 | 4118 | });
|
4119 | 4119 | ```
|
4120 | 4120 |
|
4121 |
| -**[⬆ back to top](#table-of-contents)** |
| 4121 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
4122 | 4122 |
|
4123 | 4123 | ## ECMAScript 5 Compatibility
|
4124 | 4124 |
|
4125 | 4125 | <a name="es5-compat--kangax"></a><a name="28.1"></a>
|
4126 | 4126 | - [28.1](#es5-compat--kangax) Refer to [Kangax](https://twitter.com/kangax/)’s ES5 [compatibility table](https://kangax.github.io/es5-compat-table/).
|
4127 | 4127 |
|
4128 |
| -**[⬆ back to top](#table-of-contents)** |
| 4128 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
4129 | 4129 |
|
4130 | 4130 | <a name="ecmascript-6-styles"></a>
|
4131 | 4131 | ## ECMAScript 6+ (ES 2015+) Styles
|
|
4153 | 4153 |
|
4154 | 4154 | > 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.
|
4155 | 4155 |
|
4156 |
| -**[⬆ back to top](#table-of-contents)** |
| 4156 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
4157 | 4157 |
|
4158 | 4158 | ## Testing
|
4159 | 4159 |
|
|
4166 | 4166 | - 100% test coverage is a good goal to strive for, even if it’s not always practical to reach it.
|
4167 | 4167 | - 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.
|
4168 | 4168 |
|
4169 |
| -**[⬆ back to top](#table-of-contents)** |
| 4169 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
4170 | 4170 |
|
4171 | 4171 | ## Performance
|
4172 | 4172 |
|
|
4181 | 4181 | - [Long String Concatenation](https://jsperf.com/ya-string-concat)
|
4182 | 4182 | - [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)
|
4183 | 4183 |
|
4184 |
| -**[⬆ back to top](#table-of-contents)** |
| 4184 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
4185 | 4185 |
|
4186 | 4186 | ## Resources
|
4187 | 4187 |
|
|
4248 | 4248 | - [JavaScript Air](https://javascriptair.com/)
|
4249 | 4249 | - [JavaScript Jabber](https://devchat.tv/js-jabber/)
|
4250 | 4250 |
|
4251 |
| -**[⬆ back to top](#table-of-contents)** |
| 4251 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
4252 | 4252 |
|
4253 | 4253 | ## Copyright
|
4254 | 4254 |
|
|
4258 | 4258 | <a name="copyright--license"></a><a name="33.2"></a>
|
4259 | 4259 | - [33.2](#copyright--license) It uses the same [License](https://github.com/NullDevCo/JavaScript-Styleguide/blob/master/LICENSE).
|
4260 | 4260 |
|
| 4261 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
| 4262 | + |
4261 | 4263 | ## Amendments
|
4262 | 4264 |
|
4263 | 4265 | <a name="amendments--forking"></a><a name="34.1"></a>
|
4264 | 4266 | - [34.1](#amendments--forking) We encourage you to fork this guide and change the rules to fit your team’s style guide. :smile_cat:
|
4265 | 4267 |
|
| 4268 | +**[⬆ back to top](#table-of-contents-bookmark_tabs)** |
| 4269 | + |
4266 | 4270 | <br><br><br>
|
4267 | 4271 |
|
4268 | 4272 | <p align="center">
|
|
0 commit comments