Skip to content

Commit ca5f52c

Browse files
committed
Completed problem 2 in constructors.js
1 parent d78aeea commit ca5f52c

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎constructors.js‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,18 @@ Animal.prototype.grow = function() {
2121

2222
function Cat(options) {
2323
// invoke Animal here with .call
24+
Animal.call(this, options);
2425
}
2526

2627
// connect the prototypes here
28+
Cat.prototype = Object.create(Animal.prototype);
2729

2830
// if everything is setup properly the code below will print 'Foofie grew larger!'
2931
// uncomment the code below to test your solution
3032

31-
// const foofie = new Cat({
32-
// name: 'foofie',
33-
// });
34-
//
35-
// foofie.grow();
33+
const foofie = new Cat({
34+
name: 'foofie',
35+
});
36+
37+
foofie.grow();
3638

0 commit comments

Comments
 (0)