Skip to content

Commit b70664e

Browse files
committed
reorder class declarations
1 parent 907617b commit b70664e

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

README.md

+19-19
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,16 @@ example below, the implicit contract is that any Request module for an
13251325

13261326
**Bad:**
13271327
```javascript
1328+
class InventoryRequester {
1329+
constructor() {
1330+
this.REQ_METHODS = ['HTTP'];
1331+
}
1332+
1333+
requestItem(item) {
1334+
// ...
1335+
}
1336+
}
1337+
13281338
class InventoryTracker {
13291339
constructor(items) {
13301340
this.items = items;
@@ -1341,16 +1351,6 @@ class InventoryTracker {
13411351
}
13421352
}
13431353

1344-
class InventoryRequester {
1345-
constructor() {
1346-
this.REQ_METHODS = ['HTTP'];
1347-
}
1348-
1349-
requestItem(item) {
1350-
// ...
1351-
}
1352-
}
1353-
13541354
const inventoryTracker = new InventoryTracker(['apples', 'bananas']);
13551355
inventoryTracker.requestItems();
13561356
```
@@ -1600,6 +1600,15 @@ class EmployeeTaxData extends Employee {
16001600

16011601
**Good**:
16021602
```javascript
1603+
class EmployeeTaxData {
1604+
constructor(ssn, salary) {
1605+
this.ssn = ssn;
1606+
this.salary = salary;
1607+
}
1608+
1609+
// ...
1610+
}
1611+
16031612
class Employee {
16041613
constructor(name, email) {
16051614
this.name = name;
@@ -1612,15 +1621,6 @@ class Employee {
16121621
}
16131622
// ...
16141623
}
1615-
1616-
class EmployeeTaxData {
1617-
constructor(ssn, salary) {
1618-
this.ssn = ssn;
1619-
this.salary = salary;
1620-
}
1621-
1622-
// ...
1623-
}
16241624
```
16251625
**[⬆ back to top](#table-of-contents)**
16261626

0 commit comments

Comments
 (0)