Skip to content

Commit e57774a

Browse files
committed
Finished 56th koan with comments
1 parent 9e8169a commit e57774a

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

topics/about_prototype_chain.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,39 +25,42 @@ child.b = 2;
2525
* [null]
2626
* ---------------------- ---- ---- ----
2727
* */
28-
28+
//Question 51 asks whether the variable child has an a and b property. [true]//
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

34+
//Question 52 asks what a and b are in child//
3435
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?');
36+
equal(1, child.a, 'what is \'a\' value?');
37+
equal(2, child.b, 'what is \'b\' value?');
3738
});
3839

40+
//Question 53 states that if the b vlue in child was removed what would be the b value now. In this case, it would be the father's b value which is [3]//
3941
test("If 'b' was removed, whats b value?", function () {
4042
delete child.b;
41-
equal(__, child.b, 'what is \'b\' value now?');
43+
equal(3, child.b, 'what is \'b\' value now?');
4244
});
4345

44-
46+
//Question 54 asks whether the child variable contains a c value? [false]//
4547
test("Is there a 'c' own property on child?", function () {
46-
equal(__, child.hasOwnProperty('c'), 'child.hasOwnProperty(\'c\')?');
48+
equal(false, child.hasOwnProperty('c'), 'child.hasOwnProperty(\'c\')?');
4749
});
4850

51+
//Question 55 asks about prototype. A prototype is located outside of the function and it alllows you to make all functions complete what is in the prototype without having it copied within each function. The prototype states that c is 4, so running the prototype with child gives [4]//
4952
// Is there a 'c' own property on child? No, check its prototype
5053
// Is there a 'c' own property on child.[[Prototype]]? Yes, its value is...
5154
test("Is there a 'c' property on child?", function () {
52-
equal(__, child.c, 'what is the value of child.c?');
55+
equal(4, child.c, 'what is the value of child.c?');
5356
});
5457

55-
58+
//Question 56 asks about a prototype property that does not exist. What will be the output if you ask for prototype property that does not exist. It is undefined.//
5659
// Is there a 'd' own property on child? No, check its prototype
5760
// Is there a 'd' own property on child.[[Prototype]]? No, check it prototype
5861
// child.[[Prototype]].[[Prototype]] is null, stop searching, no property found, return...
5962
test("Is there an 'd' property on child?", function () {
60-
equal(__, child.d, 'what is the value of child.d?');
63+
equal(undefined, child.d, 'what is the value of child.d?');
6164
});
6265

6366

0 commit comments

Comments
 (0)