Skip to content

Conversation

@OrChen555
Copy link

test

Copy link
Member

@Tamir198 Tamir198 left a comment

Choose a reason for hiding this comment

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

Hey looks good overall, one thing i noticed is that you are using explicitly return inside arrow functions.

Meaning:

const somethig = () => {
  return "value"
}

For simple function you can really make then 1 liner:

const somethig = () => "value"

I added a comment about this.

This is just opinion, you are not wrong

) /* : add return types */ {
return [];
function getAvailableProducts(store: Store): Product[] {
return store.products.filter((product) => { return product.inStock })
Copy link
Member

Choose a reason for hiding this comment

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

For such short function you could also use return store.products.filter((product) => product.stock

cart :number[],
) :number {
let total = 0
store.products.forEach((product) => {
Copy link
Member

Choose a reason for hiding this comment

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

Read about reduce function it can help in here

Copy link
Author

Choose a reason for hiding this comment

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

i used forEach because this was the requirement

Copy link
Member

Choose a reason for hiding this comment

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

And you did a great job, just telling you that js provides not only forEach

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