Skip to content

Conversation

@Lavi2910
Copy link

@Lavi2910 Lavi2910 commented Dec 4, 2025

No description provided.

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, i left you some comments

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

Choose a reason for hiding this comment

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

You can also do return store.products.filter((product)=>product.inStock);

Because inStock is a variable and the variable is boolean

store.ts Outdated
if (product.tags.includes(tag))
prodWithTag.push(product);
});
return prodWithTag;
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a filter function?

function getProductsByTag(store: Store, tag: string): Product[] {
  return store.products.filter(p => p.tags.includes(tag));
}

store.ts Outdated
return [];
function getAvailableProductsByTag(store : Store, tag : string) : Product[] {
const prodByTag : Product[] = getProductsByTag(store, tag);
return prodByTag.filter((product) => product.inStock===true);
Copy link
Member

Choose a reason for hiding this comment

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

product.inStock could be the condition in here as well

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.

3 participants