Skip to content

Commit abef03d

Browse files
committed
Finished 60th koan with comments
1 parent e57774a commit abef03d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

topics/about_prototypal_inheritance.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,33 @@ Mammal.prototype = {
1414
}
1515
}
1616

17+
//Question 57 aks what will happen when the sayHi function is called. The var eric will output "Hello, my name is Eric".//
1718
test("defining a 'class'", function() {
1819
var eric = new Mammal("Eric");
19-
equal(__, eric.sayHi(), 'what will Eric say?');
20+
equal("Hello, my name is Eric", eric.sayHi(), 'what will Eric say?');
2021
});
2122

2223
// add another function to the Mammal 'type' that uses the sayHi function
2324
Mammal.prototype.favouriteSaying = function() {
2425
return this.name + "'s favourite saying is " + this.sayHi();
2526
}
2627

28+
29+
//Question 58 recalls the favouriteSaying prototype so Bobby's favourite saying will be "Bobby's favourite saying is Hello, my name is Bobby"//
2730
test("more functions", function() {
2831
var bobby = new Mammal("Bobby");
29-
equal(__, bobby.favouriteSaying(), "what is Bobby's favourite saying?");
32+
equal("Bobby's favourite saying is Hello, my name is Bobby", bobby.favouriteSaying(), "what is Bobby's favourite saying?");
3033
});
3134

35+
//Question 59 asks to run this.name.length function in which this is paul. Paul has 4 letters//
3236
test("calling functions added to a prototype after an object was created", function() {
3337
var paul = new Mammal("Paul");
3438
Mammal.prototype.numberOfLettersInName = function() {
3539
return this.name.length;
3640
};
3741
// the following statement asks the paul object to call a function that was added
3842
// to the Mammal prototype after paul was constructed.
39-
equal(__, paul.numberOfLettersInName(), "how long is Paul's name?");
43+
equal(4, paul.numberOfLettersInName(), "how long is Paul's name?");
4044
});
4145

4246
// helper function for inheritance.
@@ -54,8 +58,9 @@ function Bat(name, wingspan) {
5458
// configure inheritance
5559
extend(Bat, Mammal);
5660

61+
//Question 60//
5762
test("Inheritance", function() {
5863
var lenny = new Bat("Lenny", "1.5m");
59-
equal(__, lenny.sayHi(), "what does Lenny say?");
60-
equal(__, lenny.wingspan, "what is Lenny's wingspan?");
64+
equal("Hello, my name is Lenny", lenny.sayHi(), "what does Lenny say?");
65+
equal("1.5m", lenny.wingspan, "what is Lenny's wingspan?");
6166
});

0 commit comments

Comments
 (0)