@@ -819,8 +819,8 @@ TypeScript (which, like I said, is a great alternative!).
819
819
** Bad:**
820
820
``` javascript
821
821
function combine (val1 , val2 ) {
822
- if (typeof val1 == " number" && typeof val2 == " number" ||
823
- typeof val1 == " string" && typeof val2 == " string" ) {
822
+ if (typeof val1 == ' number' && typeof val2 == ' number' ||
823
+ typeof val1 == ' string' && typeof val2 == ' string' ) {
824
824
return val1 + val2;
825
825
} else {
826
826
throw new Error (' Must be of type String or Number' );
@@ -1407,7 +1407,7 @@ classes until you find yourself needing larger and more complex objects.
1407
1407
``` javascript
1408
1408
const Animal = function (age ) {
1409
1409
if (! (this instanceof Animal)) {
1410
- throw new Error (" Instantiate Animal with `new`" );
1410
+ throw new Error (' Instantiate Animal with `new`' );
1411
1411
}
1412
1412
1413
1413
this .age = age;
@@ -1417,7 +1417,7 @@ Animal.prototype.move = function() {};
1417
1417
1418
1418
const Mammal = function (age , furColor ) {
1419
1419
if (! (this instanceof Mammal)) {
1420
- throw new Error (" Instantiate Mammal with `new`" );
1420
+ throw new Error (' Instantiate Mammal with `new`' );
1421
1421
}
1422
1422
1423
1423
Animal .call (this , age);
@@ -1430,7 +1430,7 @@ Mammal.prototype.liveBirth = function() {};
1430
1430
1431
1431
const Human = function (age , furColor , languageSpoken ) {
1432
1432
if (! (this instanceof Human)) {
1433
- throw new Error (" Instantiate Human with `new`" );
1433
+ throw new Error (' Instantiate Human with `new`' );
1434
1434
}
1435
1435
1436
1436
Mammal .call (this , age, furColor);
0 commit comments