@@ -3,30 +3,30 @@ module("About Objects (topics/about_objects.js)");
33
44test ( "object type" , function ( ) {
55 var empty_object = { } ;
6- equals ( typeof ( empty_object ) , __ , 'what is the type of an object?' ) ;
6+ equals ( typeof ( empty_object ) , "object" , 'what is the type of an object?' ) ;
77} ) ;
88
99test ( "object literal notation" , function ( ) {
1010 var person = {
11- __ : __ ,
12- __ : __
11+ name : "Amory Blaine" ,
12+ age : 102
1313 } ;
1414 equals ( person . name , "Amory Blaine" , 'what is the person\'s name?' ) ;
1515 equals ( person . age , 102 , 'what is the person\'s age?' ) ;
1616} ) ;
1717
1818test ( "dynamically adding properties" , function ( ) {
1919 var person = { } ;
20- person . __ = "Amory Blaine" ;
21- person . __ = 102 ;
20+ person . name = "Amory Blaine" ;
21+ person . age = 102 ;
2222 equals ( person . name , "Amory Blaine" , 'what is the person\'s name?' ) ;
2323 equals ( person . age , 102 , 'what is the person\'s age?' ) ;
2424} ) ;
2525
2626test ( "adding properties from strings" , function ( ) {
2727 var person = { } ;
28- person [ "__ " ] = "Amory Blaine" ;
29- person [ "__ " ] = 102 ;
28+ person [ "name " ] = "Amory Blaine" ;
29+ person [ "age " ] = 102 ;
3030 equals ( person . name , "Amory Blaine" , 'what is the person\'s name?' ) ;
3131 equals ( person . age , 102 , 'what is the person\'s age?' ) ;
3232} ) ;
@@ -36,7 +36,7 @@ test("adding functions", function() {
3636 name : "Amory Blaine" ,
3737 age : 102 ,
3838 toString : function ( ) {
39- return __ ; // HINT: use the 'this' keyword to refer to the person object.
39+ return "I " + this . name + " am " + this . age + " years old. ; // HINT: use the 'this' keyword to refer to the person object.
4040 }
4141 } ;
4242 equals ( person . toString ( ) , "I Amory Blaine am 102 years old." , 'what should the toString function be?' ) ;
0 commit comments