File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -1521,24 +1521,28 @@ Other Style Guides
15211521
15221522 let array = [1 , 2 , 3 ];
15231523 let num = 1 ;
1524- let increment = num ++ ;
1525- let decrement = -- num;
1524+ num ++ ;
1525+ -- num;
15261526
1527+ let sum = 0 ;
1528+ let truthyCount = 0 ;
15271529 for (let i = 0 ; i < array .length ; i++ ){
15281530 let value = array[i];
1529- ++ value;
1531+ sum += value;
1532+ if (value) {
1533+ truthyCount++ ;
1534+ }
15301535 }
15311536
15321537 // good
15331538
15341539 let array = [1 , 2 , 3 ];
15351540 let num = 1 ;
1536- let increment = num += 1 ;
1537- let decrement = num -= 1 ;
1541+ num += 1 ;
1542+ num -= 1 ;
15381543
1539- array .forEach ((value ) => {
1540- value += 1 ;
1541- });
1544+ const sum = array .reduce ((a , b ) => a + b, 0 );
1545+ const truthyCount = array .filter (Boolean ).length ;
15421546 ` ` `
15431547
15441548**[⬆ back to top](#table-of-contents)**
You can’t perform that action at this time.
0 commit comments