Skip to content

Week 4 js#63

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

Week 4 js#63
Adnanog wants to merge 8 commits intorarmatei:masterfrom
Adnanog:week-4

Conversation

@Adnanog
Copy link
Copy Markdown

@Adnanog Adnanog commented Apr 4, 2019

No description provided.

Copy link
Copy Markdown

@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.

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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nearly. This will return a string instead of an array.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I thought the required result is a string, so if I need to return an array, should I use map method?

Copy link
Copy Markdown

@p-maxwell p-maxwell Apr 7, 2019

Choose a reason for hiding this comment

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

You can use return [email1, email2]; to make an array.

age: 25,
currentAddress: "Glasgow",
changeAddress: function(newAddress) {
return (this.currentAddress = newAddress);
Copy link
Copy Markdown

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I changed the code, thanks

this.prices.flatWhite > this.insertedAmount
) {
return "Sorry you don't have enough money for a flatWhite";
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Similarly this is perfect, neat solution.

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