|
172
|
1 var something;
|
|
|
2
|
|
|
3 TEST('parent-child', function()
|
|
|
4 {
|
|
|
5 var parent = {};
|
|
|
6 var child = create(parent);
|
|
|
7
|
|
|
8 parent.aaa = 12;
|
|
|
9 assert( child.aaa === something );
|
|
|
10
|
|
|
11 child.aaa = 24;
|
|
|
12 assert( parent.aaa === something );
|
|
|
13
|
|
|
14 parent.aaa = 36;
|
|
|
15 assert (child.aaa === something );
|
|
|
16
|
|
|
17 delete child.aaa;
|
|
|
18 assert( child.aaa === something );
|
|
|
19 });
|
|
|
20
|
|
|
21
|
|
|
22 TEST("what's the tree?", function()
|
|
|
23 {
|
|
|
24 var a;
|
|
|
25 var b;
|
|
|
26 var c;
|
|
|
27
|
|
|
28 // Please write your answer here.
|
|
|
29 // Don't use aaa, bbb or ccc in your code.
|
|
|
30
|
|
|
31 a.aaa = 1;
|
|
|
32 assert( b.aaa === undefined );
|
|
|
33 assert( c.aaa === 1 );
|
|
|
34
|
|
|
35 b.bbb = 2;
|
|
|
36 assert( a.bbb === 2 );
|
|
|
37 assert( c.bbb === 2 );
|
|
|
38
|
|
|
39 c.ccc = 3;
|
|
|
40 assert( a.ccc === undefined );
|
|
|
41 assert( b.ccc === undefined );
|
|
|
42
|
|
|
43 });
|