@@ -738,13 +738,13 @@ Other Style Guides
738738
739739 ` ` ` javascript
740740 // bad
741- function concatenateAllStrings () {
741+ function concatenateAll () {
742742 const args = Array .prototype .slice .call (arguments );
743743 return args .join (' ' );
744744 }
745745
746746 // good
747- function concatenateAllStrings (... args ) {
747+ function concatenateAll (... args ) {
748748 return args .join (' ' );
749749 }
750750 ` ` `
@@ -852,11 +852,6 @@ Other Style Guides
852852 function f2(obj) {
853853 const key = Object.prototype.hasOwnProperty.call(obj, 'key') ? obj.key : 1;
854854 }
855-
856- // best
857- function f2(obj) {
858- const key = Object.hasOwn(obj, 'key') ? obj.key : 1;
859- }
860855 ` ` `
861856
862857 < a name= " functions--reassign-params" >< / a>< a name= " 7.13" >< / a>
@@ -1198,7 +1193,8 @@ Other Style Guides
11981193
11991194 const luke = new Jedi ();
12001195
1201- luke .jump ().setHeight (20 );
1196+ luke .jump ()
1197+ .setHeight (20 );
12021198 ` ` `
12031199
12041200 <a name="constructors--tostring"></a><a name="9.4"></a>
@@ -1329,7 +1325,7 @@ Other Style Guides
13291325 ` ` `
13301326
13311327 < a name= " modules--no-wildcard" >< / a>< a name= " 10.2" >< / a>
1332- - [10.2 ](#modules-- no- wildcard) Do not use wildcard imports unless you have multiple named exports and want to import all of them as single object .
1328+ - [10.2 ](#modules-- no- wildcard) Do not use wildcard imports.
13331329
13341330 > Why? This makes sure you have a single default export .
13351331
@@ -1791,6 +1787,7 @@ Other Style Guides
17911787
17921788 ```javascript
17931789 // bad
1790+
17941791 const array = [1, 2, 3];
17951792 let num = 1;
17961793 num++;
@@ -1807,6 +1804,7 @@ Other Style Guides
18071804 }
18081805
18091806 // good
1807+
18101808 const array = [1, 2, 3];
18111809 let num = 1;
18121810 num += 1;
@@ -1846,6 +1844,7 @@ Other Style Guides
18461844
18471845 ```javascript
18481846 // bad
1847+
18491848 const some_unused_var = 42;
18501849
18511850 // Write-only variables are not considered as used.
@@ -1862,6 +1861,7 @@ Other Style Guides
18621861 }
18631862
18641863 // good
1864+
18651865 function getXPlusY(x, y) {
18661866 return x + y;
18671867 }
@@ -2165,7 +2165,7 @@ Other Style Guides
21652165 const foo = a ? a : b;
21662166 const bar = c ? true : false;
21672167 const baz = c ? false : true;
2168- const quux = ( a !== undefined && a !== null) ? a : b;
2168+ const quux = a != null ? a : b;
21692169
21702170 // good
21712171 const foo = a || b;
@@ -2966,12 +2966,11 @@ Other Style Guides
29662966 ? .xyzzy ;
29672967
29682968 // good
2969- $
2970- .ajax ({
2971- method: ' POST' ,
2972- url: ' https://airbnb.com/' ,
2973- data: { name: ' John' },
2974- })
2969+ $ .ajax ({
2970+ method: ' POST' ,
2971+ url: ' https://airbnb.com/' ,
2972+ data: { name: ' John' },
2973+ })
29752974 .done (() => console .log (' Congratulations!' ))
29762975 .fail (() => console .log (' You have failed this city.' ));
29772976 ` ` `
0 commit comments