Skip to content

Conversation

@brauni18
Copy link

@brauni18 brauni18 commented Dec 5, 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.

Hey good work

) /* : add return types */ {
return [];
const getAvailableProducts = () => {
const availableProducts: Product[] = store.products.filter(product => 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.

You can return the filter instead of saving it inside a variable
This is just an opinion and you can choose to write explicitly

function getCartTotalInStock(store: Store , cart: number[]) : number {
const cartProducts: Product[] = getCartProducts(store, cart);
let total = 0;
cartProducts.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.

Great, you can also use reduce

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