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 11module ( "About Reflection (topics/about_reflection.js)" ) ;
22
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+
313test ( "typeof" , function ( ) {
414 equals ( typeof ( { } ) , __ , 'what is the type of an empty object?' ) ;
515 equals ( typeof ( 'apple' ) , __ , 'what is the type of a string?' ) ;
@@ -20,17 +30,6 @@ test("property enumeration", function() {
2030} ) ;
2131
2232test ( "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-
3433 var b = new B ( ) ;
3534
3635 var keys = [ ] ;
@@ -52,6 +51,14 @@ test("hasOwnProperty", function() {
5251 ok ( ownKeys . equalTo ( [ __ , __ ] ) , 'what are the own properties of the array?' ) ;
5352} ) ;
5453
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+
5562test ( "eval" , function ( ) {
5663 // eval executes a string
5764 var result = "" ;
You can’t perform that action at this time.
0 commit comments