File tree Expand file tree Collapse file tree 1 file changed +19
-19
lines changed
Expand file tree Collapse file tree 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
13281328
13291329** Bad:**
13301330``` javascript
1331+ class InventoryRequester {
1332+ constructor () {
1333+ this .REQ_METHODS = [' HTTP' ];
1334+ }
1335+
1336+ requestItem (item ) {
1337+ // ...
1338+ }
1339+ }
1340+
13311341class InventoryTracker {
13321342 constructor (items ) {
13331343 this .items = items;
@@ -1344,16 +1354,6 @@ class InventoryTracker {
13441354 }
13451355}
13461356
1347- class InventoryRequester {
1348- constructor () {
1349- this .REQ_METHODS = [' HTTP' ];
1350- }
1351-
1352- requestItem (item ) {
1353- // ...
1354- }
1355- }
1356-
13571357const inventoryTracker = new InventoryTracker ([' apples' , ' bananas' ]);
13581358inventoryTracker .requestItems ();
13591359```
@@ -1603,6 +1603,15 @@ class EmployeeTaxData extends Employee {
16031603
16041604** Good** :
16051605``` javascript
1606+ class EmployeeTaxData {
1607+ constructor (ssn , salary ) {
1608+ this .ssn = ssn;
1609+ this .salary = salary;
1610+ }
1611+
1612+ // ...
1613+ }
1614+
16061615class Employee {
16071616 constructor (name , email ) {
16081617 this .name = name;
@@ -1615,15 +1624,6 @@ class Employee {
16151624 }
16161625 // ...
16171626}
1618-
1619- class EmployeeTaxData {
1620- constructor (ssn , salary ) {
1621- this .ssn = ssn;
1622- this .salary = salary;
1623- }
1624-
1625- // ...
1626- }
16271627```
16281628** [ ⬆ back to top] ( #table-of-contents ) **
16291629
You can’t perform that action at this time.
0 commit comments