Skip to content

Conversation

@AsherPe
Copy link

@AsherPe AsherPe commented Dec 5, 2025

No description provided.

@AsherPe AsherPe changed the title First update Online store task - Asher Pe'er Dec 5, 2025
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.

Good work, left you some comments

) /* : add return types */ {
return [];
function getProductsByTag( store : Store , tag : string[] ) : Product[] {
return store.products.filter(product => tag.some(tg => product.tags.includes(tg)));
Copy link
Member

Choose a reason for hiding this comment

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

Can yo explain why do you have the some method in here?
You are not wrong, just wanted to hear your opinion

) /* : add return types */ {
return [];
function getCartProducts(store : Store , cart : number[] ) : Product[] {
return cart.flatMap(productId => store.products.filter(product => product.id === productId));
Copy link
Member

Choose a reason for hiding this comment

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

Cart is an array of numbers, what good is the flatMap in here?

return 0;
function getCartTotalInStock( store : Store, cart : number[]) : number {
let total = 0;
for(const id of cart){
Copy link
Member

Choose a reason for hiding this comment

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

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