Skip to content

Conversation

@appzing
Copy link

@appzing appzing commented Dec 15, 2016

No description provided.


expected = Reptile.SOUND;
actual = reptile.speak();
test.equal( actual, expected, 'should make a reptile sound when it speaks' );
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is failing but I don't understand why.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is failing because you said this.SOUND in your constructor, where this refers to the "instance" of the reptile, whereas Reptile does not refer to the instance but to the constructor. Does that difference make sense?

As a first hint, if you can access it via Reptile.SOUND, how might you set it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha! Its should be expected = reptile.SOUND

Copy link
Owner

@joshdmiller joshdmiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've got the structure right; check out my response to your question. But you're getting it! 👍


expected = Reptile.SOUND;
actual = reptile.speak();
test.equal( actual, expected, 'should make a reptile sound when it speaks' );
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is failing because you said this.SOUND in your constructor, where this refers to the "instance" of the reptile, whereas Reptile does not refer to the instance but to the constructor. Does that difference make sense?

As a first hint, if you can access it via Reptile.SOUND, how might you set it?


Reptile.prototype = Object.create(Animal.prototype)
export class Reptile extends Animal {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please explain what super does in the next class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants