Skip to content

Week 4 practice js#64

Open
Adnanog wants to merge 4 commits intorarmatei:masterfrom
Adnanog:week-4-practice
Open

Week 4 practice js#64
Adnanog wants to merge 4 commits intorarmatei:masterfrom
Adnanog:week-4-practice

Conversation

@Adnanog
Copy link

@Adnanog Adnanog commented Apr 4, 2019

No description provided.

Copy link

@p-maxwell p-maxwell left a comment

Choose a reason for hiding this comment

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

Second one isn't quite right, but the first one is perfect.

);
});

console.log(aliveOnly);

Choose a reason for hiding this comment

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

Good solution.

volume: 0,
fill: function() {
// calling this function should make you bottles volume = 100;
return (this.volume = this.volume + 100); // calling this function should make you bottles volume = 100;

Choose a reason for hiding this comment

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

You don't actually need to return anything here. More importantly though, this function will overfill the bottle - filling it to the top should leave it at 100, like 100%. If it's half full this takes it to 150...

},
drink: function() {
// calling this function should decrease your bottles volume by 10;
return (this.fill = this.fill - 10); // calling this function should decrease your bottles volume by 10;

Choose a reason for hiding this comment

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

Should use this.volume here, not this.fill. Again nothing needs to be returned.

},
empty: function() {
// this function should return true if your bottles volume = 0
return (this.fill = this.volume); // this function should return true if your bottles volume = 0

Choose a reason for hiding this comment

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

This won't work. How do you check the volume is zero?

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