@@ -744,11 +744,11 @@ class Airplane {
744744 getCruisingAltitude () {
745745 switch (this .type ) {
746746 case ' 777' :
747- return getMaxAltitude () - getPassengerCount ();
747+ return this . getMaxAltitude () - this . getPassengerCount ();
748748 case ' Air Force One' :
749- return getMaxAltitude ();
749+ return this . getMaxAltitude ();
750750 case ' Cessna' :
751- return getMaxAltitude () - getFuelExpenditure ();
751+ return this . getMaxAltitude () - this . getFuelExpenditure ();
752752 }
753753 }
754754}
@@ -763,21 +763,21 @@ class Airplane {
763763class Boeing777 extends Airplane {
764764 // ...
765765 getCruisingAltitude () {
766- return getMaxAltitude () - getPassengerCount ();
766+ return this . getMaxAltitude () - this . getPassengerCount ();
767767 }
768768}
769769
770770class AirForceOne extends Airplane {
771771 // ...
772772 getCruisingAltitude () {
773- return getMaxAltitude ();
773+ return this . getMaxAltitude ();
774774 }
775775}
776776
777777class Cessna extends Airplane {
778778 // ...
779779 getCruisingAltitude () {
780- return getMaxAltitude () - getFuelExpenditure ();
780+ return this . getMaxAltitude () - this . getFuelExpenditure ();
781781 }
782782}
783783```
@@ -1009,12 +1009,12 @@ class UserSettings {
10091009 }
10101010
10111011 changeSettings (settings ) {
1012- if (this .verifyCredentials (user )) {
1012+ if (this .verifyCredentials ()) {
10131013 // ...
10141014 }
10151015 }
10161016
1017- verifyCredentials (user ) {
1017+ verifyCredentials () {
10181018 // ...
10191019 }
10201020}
@@ -1410,35 +1410,35 @@ classes until you find yourself needing larger and more complex objects.
14101410** Bad:**
14111411``` javascript
14121412const Animal = function (age ) {
1413- if (! (this instanceof Animal)) {
1414- throw new Error (" Instantiate Animal with `new`" );
1415- }
1413+ if (! (this instanceof Animal)) {
1414+ throw new Error (" Instantiate Animal with `new`" );
1415+ }
14161416
1417- this .age = age;
1417+ this .age = age;
14181418};
14191419
14201420Animal .prototype .move = function () {};
14211421
14221422const Mammal = function (age , furColor ) {
1423- if (! (this instanceof Mammal)) {
1424- throw new Error (" Instantiate Mammal with `new`" );
1425- }
1423+ if (! (this instanceof Mammal)) {
1424+ throw new Error (" Instantiate Mammal with `new`" );
1425+ }
14261426
1427- Animal .call (this , age);
1428- this .furColor = furColor;
1427+ Animal .call (this , age);
1428+ this .furColor = furColor;
14291429};
14301430
14311431Mammal .prototype = Object .create (Animal .prototype );
14321432Mammal .prototype .constructor = Mammal;
14331433Mammal .prototype .liveBirth = function () {};
14341434
14351435const Human = function (age , furColor , languageSpoken ) {
1436- if (! (this instanceof Human)) {
1437- throw new Error (" Instantiate Human with `new`" );
1438- }
1436+ if (! (this instanceof Human)) {
1437+ throw new Error (" Instantiate Human with `new`" );
1438+ }
14391439
1440- Mammal .call (this , age, furColor);
1441- this .languageSpoken = languageSpoken;
1440+ Mammal .call (this , age, furColor);
1441+ this .languageSpoken = languageSpoken;
14421442};
14431443
14441444Human .prototype = Object .create (Mammal .prototype );
@@ -1449,29 +1449,29 @@ Human.prototype.speak = function() {};
14491449** Good:**
14501450``` javascript
14511451class Animal {
1452- constructor (age ) {
1453- this .age = age;
1454- }
1452+ constructor (age ) {
1453+ this .age = age;
1454+ }
14551455
1456- move () {}
1456+ move () { /* ... */ }
14571457}
14581458
14591459class Mammal extends Animal {
1460- constructor (age , furColor ) {
1461- super (age);
1462- this .furColor = furColor;
1463- }
1460+ constructor (age , furColor ) {
1461+ super (age);
1462+ this .furColor = furColor;
1463+ }
14641464
1465- liveBirth () {}
1465+ liveBirth () { /* ... */ }
14661466}
14671467
14681468class Human extends Mammal {
1469- constructor (age , furColor , languageSpoken ) {
1470- super (age, furColor);
1471- this .languageSpoken = languageSpoken;
1472- }
1469+ constructor (age , furColor , languageSpoken ) {
1470+ super (age, furColor);
1471+ this .languageSpoken = languageSpoken;
1472+ }
14731473
1474- speak () {}
1474+ speak () { /* ... */ }
14751475}
14761476```
14771477** [ ⬆ back to top] ( #table-of-contents ) **
0 commit comments