File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -629,7 +629,6 @@ class Cesna extends Airplane {
629
629
```
630
630
**[⬆ back to top](#table-of-contents)**
631
631
632
-
633
632
### Avoid type-checking (part 1)
634
633
JavaScript is untyped, which means your functions can take any type of argument.
635
634
Sometimes you are bitten by this freedom and it becomes tempting to do
@@ -711,6 +710,36 @@ for (var i = 0; i < list.length; i++) {
711
710
```
712
711
**[⬆ back to top](#table-of-contents)**
713
712
713
+ ### Remove dead code
714
+ Dead code is just as bad as duplicate code. There's no reason to keep it in
715
+ your codebase. If it's not being called, get rid of it! It will still be safe
716
+ in your version history if you still need it.
717
+
718
+ **Bad:**
719
+ ```javascript
720
+ function oldRequestModule(url) {
721
+ // ...
722
+ }
723
+
724
+ function newRequestModule(url) {
725
+ // ...
726
+ }
727
+
728
+ var req = newRequestModule;
729
+ inventoryTracker('apples', req, 'www.inventory-awesome.io');
730
+
731
+ ```
732
+
733
+ **Good**:
734
+ ```javascript
735
+ function newRequestModule(url) {
736
+ // ...
737
+ }
738
+
739
+ var req = newRequestModule;
740
+ inventoryTracker('apples', req, 'www.inventory-awesome.io');
741
+ ```
742
+ **[⬆ back to top](#table-of-contents)**
714
743
715
744
## **Objects and Data Structures**
716
745
### Use getters and setters
You can’t perform that action at this time.
0 commit comments