Skip to content

Commit 50d60ad

Browse files
Alex WeiksnarAlex Weiksnar
authored andcommitted
60 koans
1 parent a2951ae commit 50d60ad

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

topics/about_prototypal_inheritance.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Mammal.prototype = {
1616

1717
test("defining a 'class'", function() {
1818
var eric = new Mammal("Eric");
19-
equal(__, eric.sayHi(), 'what will Eric say?');
19+
equal("Hello, my name is Eric", eric.sayHi(), 'what will Eric say?');
2020
});
2121

2222
// add another function to the Mammal 'type' that uses the sayHi function
@@ -26,7 +26,7 @@ Mammal.prototype.favouriteSaying = function() {
2626

2727
test("more functions", function() {
2828
var bobby = new Mammal("Bobby");
29-
equal(__, bobby.favouriteSaying(), "what is Bobby's favourite saying?");
29+
equal("Bobby's favourite saying is Hello, my name is Bobby", bobby.favouriteSaying(), "what is Bobby's favourite saying?");
3030
});
3131

3232
test("calling functions added to a prototype after an object was created", function() {
@@ -36,7 +36,7 @@ test("calling functions added to a prototype after an object was created", funct
3636
};
3737
// the following statement asks the paul object to call a function that was added
3838
// to the Mammal prototype after paul was constructed.
39-
equal(__, paul.numberOfLettersInName(), "how long is Paul's name?");
39+
equal(4, paul.numberOfLettersInName(), "how long is Paul's name?");
4040
});
4141

4242
// helper function for inheritance.
@@ -56,6 +56,6 @@ extend(Bat, Mammal);
5656

5757
test("Inheritance", function() {
5858
var lenny = new Bat("Lenny", "1.5m");
59-
equal(__, lenny.sayHi(), "what does Lenny say?");
60-
equal(__, lenny.wingspan, "what is Lenny's wingspan?");
59+
equal("Hello, my name is Lenny", lenny.sayHi(), "what does Lenny say?");
60+
equal("1.5m", lenny.wingspan, "what is Lenny's wingspan?");
6161
});

topics/about_prototype_chain.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,37 +27,37 @@ child.b = 2;
2727
* */
2828

2929
test("Is there an 'a' and 'b' own property on child?", function () {
30-
equal(__, child.hasOwnProperty('a'), 'child.hasOwnProperty(\'a\')?');
31-
equal(__, child.hasOwnProperty('b'), 'child.hasOwnProperty(\'b\')?');
30+
equal(true, child.hasOwnProperty('a'), 'child.hasOwnProperty(\'a\')?');
31+
equal(true, child.hasOwnProperty('b'), 'child.hasOwnProperty(\'b\')?');
3232
});
3333

3434
test("Is there an 'a' and 'b' property on child?", function () {
35-
equal(__, child.a, 'what is \'a\' value?');
36-
equal(__, child.b, 'what is \'b\' value?');
35+
equal(1, child.a, 'what is \'a\' value?');
36+
equal(2, child.b, 'what is \'b\' value?');
3737
});
3838

3939
test("If 'b' was removed, whats b value?", function () {
4040
delete child.b;
41-
equal(__, child.b, 'what is \'b\' value now?');
41+
equal(3, child.b, 'what is \'b\' value now?');
4242
});
4343

4444

4545
test("Is there a 'c' own property on child?", function () {
46-
equal(__, child.hasOwnProperty('c'), 'child.hasOwnProperty(\'c\')?');
46+
equal(false, child.hasOwnProperty('c'), 'child.hasOwnProperty(\'c\')?');
4747
});
4848

4949
// Is there a 'c' own property on child? No, check its prototype
5050
// Is there a 'c' own property on child.[[Prototype]]? Yes, its value is...
5151
test("Is there a 'c' property on child?", function () {
52-
equal(__, child.c, 'what is the value of child.c?');
52+
equal(4, child.c, 'what is the value of child.c?');
5353
});
5454

5555

5656
// Is there a 'd' own property on child? No, check its prototype
5757
// Is there a 'd' own property on child.[[Prototype]]? No, check it prototype
5858
// child.[[Prototype]].[[Prototype]] is null, stop searching, no property found, return...
5959
test("Is there an 'd' property on child?", function () {
60-
equal(__, child.d, 'what is the value of child.d?');
60+
equal(undefined, child.d, 'what is the value of child.d?');
6161
});
6262

6363

0 commit comments

Comments
 (0)