Created
July 19, 2020 09:20
-
-
Save Sarav-S/f51fd50d10928b3cc345eae290429ac6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cart = { | |
items: [ | |
{ name: 'Item 1', value: 200, in_stock: true }, | |
{ name: 'Item 2', value: 100, in_stock: false }, | |
{ name: 'Item 3', value: 200, in_stock: true }, | |
] | |
} | |
// Using traditional javascript | |
const inStock = items => items.filter(item => item.in_stock); | |
const inStockItems = inStock(cart.items); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment