Skip to content

Commit e3406cb

Browse files
committed
Object tests passing
1 parent 6598a8b commit e3406cb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

topics/about_objects.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@ $(document).ready(function(){
55

66
test("object type", function() {
77
var empty_object = {};
8-
equals(typeof(empty_object), __, 'what is the type of an object?');
8+
equals(typeof(empty_object), "object", 'what is the type of an object?');
99
});
1010

1111
test("object literal notation", function() {
1212
var person = {
13-
__:__,
14-
__:__
13+
name:"Amory Blaine",
14+
age:102
1515
};
1616
equals(person.name, "Amory Blaine", 'what is the person\'s name?');
1717
equals(person.age, 102, 'what is the person\'s age?');
1818
});
1919

2020
test("dynamically adding properties", function() {
2121
var person = {};
22-
person.__ = "Amory Blaine";
23-
person.__ = 102;
22+
person.name = "Amory Blaine";
23+
person.age = 102;
2424
equals(person.name, "Amory Blaine", 'what is the person\'s name?');
2525
equals(person.age, 102, 'what is the person\'s age?');
2626
});
2727

2828
test("adding properties from strings", function() {
2929
var person = {};
30-
person["__"] = "Amory Blaine";
31-
person["__"] = 102;
30+
person["name"] = "Amory Blaine";
31+
person["age"] = 102;
3232
equals(person.name, "Amory Blaine", 'what is the person\'s name?');
3333
equals(person.age, 102, 'what is the person\'s age?');
3434
});
@@ -38,7 +38,7 @@ $(document).ready(function(){
3838
name: "Amory Blaine",
3939
age: 102,
4040
toString: function() {
41-
return __; // HINT: use the 'this' keyword to refer to the person object.
41+
return "I " + this.name + " am " + this.age + " years old."; // HINT: use the 'this' keyword to refer to the person object.
4242
}
4343
};
4444
equals(person.toString(), "I Amory Blaine am 102 years old.", 'what should the toString function be?');

0 commit comments

Comments
 (0)