Week 4 & week-4-practice by Vicky#62
Week 4 & week-4-practice by Vicky#62viktoriia-kosenko wants to merge 8 commits intorarmatei:masterfrom
Conversation
tekul
left a comment
There was a problem hiding this comment.
👍 Great work. I had one or two small suggestions and questions so try to get back to me on those. No major problems with objects though 🙂 .
| ) | ||
| ); | ||
|
|
||
| messageAboutWriter; |
There was a problem hiding this comment.
Looks good! Why the messageAboutWriter on the last line though?
There was a problem hiding this comment.
Have no idea why. But I've already deleted it.
week-4/D-methods/exercise-5.js
Outdated
| ) { | ||
| return "Please take your " + coffee; | ||
| } else { | ||
| return "Sorry you don't have enough money for a " + coffee; |
There was a problem hiding this comment.
I would just use a plain string in each case, rather than appending the variable coffee, so "Please take your cappuccino", since you know that's what it is. However this code is quite repetitive (it has return "Please take your " + coffee; 3 times). It might be better to separate the lookup of the price from the printing out of the "Please take your ..." messages. You could have something like this:
getCoffee: function(coffee) {
var price = this.prices[coffee];
if (this.insertedAmount >= price) {
return "Please take your " + coffee;
}
return "Sorry you don't have enough money for a " + coffee;
}
There was a problem hiding this comment.
your solution looks perfect!
| volume: 0, | ||
| fill: function() { | ||
| // calling this function should make you bottles volume = 100; | ||
| return (this.volume = 100); // calling this function should make you bottles volume = 100; |
There was a problem hiding this comment.
Why the return here (and in the drink function)?
| var personsYoungerThan28YearsOld = // Complete here | ||
| var personNames = persons.map(person => person.name); // Complete here | ||
|
|
||
| var personsYoungerThan28YearsOld = persons.filter(person => person.age < 28); // Complete here |
| ) | ||
| .map(destination => destination.destinationName); // Complete here (PRINT THE RESULT IN THE CONSOLE USING FOREACH) | ||
|
|
||
| destinationNamesMoreThan300KmsAwayByTrain; |
There was a problem hiding this comment.
Why the variable name here again? Are you confusing this with calling functions? You don't need to do this with variables.
There was a problem hiding this comment.
to be honest i don't know why it is there. But maybe I wasn't attentive enough and i didn't notice it. I deleted it.
| 0 | ||
| ) | ||
| .map(restaurant => restaurant.name); | ||
| // Complete here |
There was a problem hiding this comment.
Try to get in the habit of removing any outdated comments when you commit. You could remove the // Complete here comments when you've done the work.
No description provided.