Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f83f4e4

Browse files
committed
Remove dead code
1 parent ea1735d commit f83f4e4

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,6 @@ class Cesna extends Airplane {
629629
```
630630
**[⬆ back to top](#table-of-contents)**
631631

632-
633632
### Avoid type-checking (part 1)
634633
JavaScript is untyped, which means your functions can take any type of argument.
635634
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++) {
711710
```
712711
**[⬆ back to top](#table-of-contents)**
713712

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)**
714743

715744
## **Objects and Data Structures**
716745
### Use getters and setters

0 commit comments

Comments
 (0)