Conversation
p-maxwell
left a comment
There was a problem hiding this comment.
There were a couple of minor points that could be improved, but overall this was very well done.
| function getEmailAddresses(house1, house2) { | ||
| var email1 = house1.currentOwner.email; | ||
| var email2 = house2.currentOwner.email; | ||
| return email1 + ", " + email2; |
There was a problem hiding this comment.
Nearly. This will return a string instead of an array.
There was a problem hiding this comment.
I thought the required result is a string, so if I need to return an array, should I use map method?
There was a problem hiding this comment.
You can use return [email1, email2]; to make an array.
week-4/D-methods/exercise-3.js
Outdated
| age: 25, | ||
| currentAddress: "Glasgow", | ||
| changeAddress: function(newAddress) { | ||
| return (this.currentAddress = newAddress); |
There was a problem hiding this comment.
You don't actually need to return anything here.
| this.prices.flatWhite > this.insertedAmount | ||
| ) { | ||
| return "Sorry you don't have enough money for a flatWhite"; | ||
| } |
There was a problem hiding this comment.
Careful. This function will break if someone tries to buy a blackCoffee but doesn't have enough money to pay for it.
| }) | ||
| .map(function(destination) { | ||
| return destination.destinationName; | ||
| }); // Complete here (PRINT THE RESULT IN THE CONSOLE USING FOREACH) |
There was a problem hiding this comment.
Just wanted to say well done with this one, lots of people had difficulty with this. You've got a good solution.
| countNumberOfRestaurantsInArea: function(area) { | ||
| return this.restaurants.filter(function(restaurant) { | ||
| return restaurant.address.area === area; | ||
| }).length; |
There was a problem hiding this comment.
Similarly this is perfect, neat solution.
No description provided.