Skip to content

Conversation

@beny25585
Copy link

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 so 2 main things that i see repeating:

No console logs
You dont have to booleanVariable === true inside a condition, if(booleanVariable) is eonugh

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 could do something like this :

  return store.products.filter((product)=>product.inStock);

Because the inStock in a boolean

store.ts Outdated
function getAvailableProducts(store: Store): Product[] {
return store.products.filter((product) => product.inStock === true);
}
console.log("getAvailableProducts:", getAvailableProducts(store));
Copy link
Member

Choose a reason for hiding this comment

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

When we submit prs in the industry we remove the console.logs

store.ts Outdated
(p) => p.price >= minPrice && p.price <= maxPrice
);
}
console.log("getProductsInPriceRange", getProductsInPriceRange(store, 10, 100));
Copy link
Member

Choose a reason for hiding this comment

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

Save 10 and 100 inside variables, otherwise those are just magic numbers and we dont really have a context for them

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