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

Skip to content

Commit 3f94eb2

Browse files
Merge pull request ryanmcdermott#96 from vsemozhetbyt/no-use-before-define
reorder class declarations
2 parents 2d59de7 + b70664e commit 3f94eb2

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff 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+
13311341
class 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-
13571357
const inventoryTracker = new InventoryTracker(['apples', 'bananas']);
13581358
inventoryTracker.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+
16061615
class 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

0 commit comments

Comments
 (0)