File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change 1
1
module ( "About Reflection (topics/about_reflection.js)" ) ;
2
2
3
+ var A = function ( ) {
4
+ this . aprop = "A" ;
5
+ } ;
6
+
7
+ var B = function ( ) {
8
+ this . bprop = "B" ;
9
+ } ;
10
+
11
+ B . prototype = new A ( ) ;
12
+
3
13
test ( "typeof" , function ( ) {
4
14
equals ( typeof ( { } ) , __ , 'what is the type of an empty object?' ) ;
5
15
equals ( typeof ( 'apple' ) , __ , 'what is the type of a string?' ) ;
@@ -20,17 +30,6 @@ test("property enumeration", function() {
20
30
} ) ;
21
31
22
32
test ( "hasOwnProperty" , function ( ) {
23
-
24
- var A = function ( ) {
25
- this . aprop = "A" ;
26
- } ;
27
-
28
- var B = function ( ) {
29
- this . bprop = "B" ;
30
- } ;
31
-
32
- B . prototype = new A ( ) ;
33
-
34
33
var b = new B ( ) ;
35
34
36
35
var keys = [ ] ;
@@ -52,6 +51,14 @@ test("hasOwnProperty", function() {
52
51
ok ( ownKeys . equalTo ( [ __ , __ ] ) , 'what are the own properties of the array?' ) ;
53
52
} ) ;
54
53
54
+ test ( "constructor property" , function ( ) {
55
+ var a = new A ( ) ;
56
+ var b = new B ( ) ;
57
+ equals ( typeof ( a . constructor ) , __ , "what is the type of a's constructor?" ) ;
58
+ equals ( a . constructor . name , __ , "what is the name of a's constructor?" ) ;
59
+ equals ( a . constructor . name , __ , "what is the name of b's constructor?" ) ;
60
+ } ) ;
61
+
55
62
test ( "eval" , function ( ) {
56
63
// eval executes a string
57
64
var result = "" ;
You can’t perform that action at this time.
0 commit comments