@@ -445,7 +445,7 @@ function writeForumComment(subject, body) {
|
445 | 445 |
|
446 | 446 | **Good**:
|
447 | 447 | ```javascript
|
448 |
| -function writeForumComment(subject='No subject', body='No text') { |
| 448 | +function writeForumComment(subject = 'No subject', body = 'No text') { |
449 | 449 | ...
|
450 | 450 | }
|
451 | 451 |
|
@@ -790,7 +790,7 @@ The first thing to consider is consistent APIs.
|
790 | 790 | **Bad:**
|
791 | 791 | ```javascript
|
792 | 792 | function travelToTexas(vehicle) {
|
793 |
| -if (obj instanceof Bicylce) { |
| 793 | +if (obj instanceof Bicycle) { |
794 | 794 | vehicle.peddle(this.currentLocation, new Location('texas'));
|
795 | 795 | } else if (obj instanceof Car) {
|
796 | 796 | vehicle.drive(this.currentLocation, new Location('texas'));
|
@@ -897,7 +897,7 @@ inventoryTracker('apples', req, 'www.inventory-awesome.io');
|
897 | 897 | ### Use getters and setters
|
898 | 898 | JavaScript doesn't have interfaces or types so it is very hard to enforce this
|
899 | 899 | pattern, because we don't have keywords like `public` and `private`. As it is,
|
900 |
| -using getters and setters to access data on objects if far better than simply |
| 900 | +using getters and setters to access data on objects is far better than simply |
901 | 901 | looking for a property on an object. "Why?" you might ask. Well, here's an
|
902 | 902 | unorganized list of reasons why:
|
903 | 903 |
|
@@ -1558,7 +1558,7 @@ you should prefer composition over inheritance where you can. There are lots of
|
1558 | 1558 | good reasons to use inheritance and lots of good reasons to use composition.
|
1559 | 1559 | The main point for this maxim is that if your mind instinctively goes for
|
1560 | 1560 | inheritance, try to think if composition could model your problem better. In some
|
1561 |
| -cases it can. Inheritance is great for preventing |
| 1561 | +cases it can. |
1562 | 1562 |
|
1563 | 1563 | You might be wondering then, "when should I use inheritance?" It
|
1564 | 1564 | depends on your problem at hand, but this is a decent list of when inheritance
|
|
0 commit comments