File tree 1 file changed +19
-19
lines changed
1 file changed +19
-19
lines changed Original file line number Diff line number Diff line change @@ -1328,6 +1328,16 @@ example below, the implicit contract is that any Request module for an
1328
1328
1329
1329
** Bad:**
1330
1330
``` javascript
1331
+ class InventoryRequester {
1332
+ constructor () {
1333
+ this .REQ_METHODS = [' HTTP' ];
1334
+ }
1335
+
1336
+ requestItem (item ) {
1337
+ // ...
1338
+ }
1339
+ }
1340
+
1331
1341
class InventoryTracker {
1332
1342
constructor (items ) {
1333
1343
this .items = items;
@@ -1344,16 +1354,6 @@ class InventoryTracker {
1344
1354
}
1345
1355
}
1346
1356
1347
- class InventoryRequester {
1348
- constructor () {
1349
- this .REQ_METHODS = [' HTTP' ];
1350
- }
1351
-
1352
- requestItem (item ) {
1353
- // ...
1354
- }
1355
- }
1356
-
1357
1357
const inventoryTracker = new InventoryTracker ([' apples' , ' bananas' ]);
1358
1358
inventoryTracker .requestItems ();
1359
1359
```
@@ -1603,6 +1603,15 @@ class EmployeeTaxData extends Employee {
1603
1603
1604
1604
** Good** :
1605
1605
``` javascript
1606
+ class EmployeeTaxData {
1607
+ constructor (ssn , salary ) {
1608
+ this .ssn = ssn;
1609
+ this .salary = salary;
1610
+ }
1611
+
1612
+ // ...
1613
+ }
1614
+
1606
1615
class Employee {
1607
1616
constructor (name , email ) {
1608
1617
this .name = name;
@@ -1615,15 +1624,6 @@ class Employee {
1615
1624
}
1616
1625
// ...
1617
1626
}
1618
-
1619
- class EmployeeTaxData {
1620
- constructor (ssn , salary ) {
1621
- this .ssn = ssn;
1622
- this .salary = salary;
1623
- }
1624
-
1625
- // ...
1626
- }
1627
1627
```
1628
1628
** [ ⬆ back to top] ( #table-of-contents ) **
1629
1629
You can’t perform that action at this time.
0 commit comments