Skip to content

Instantly share code, notes, and snippets.

@parzibyte

parzibyte/carrito.js

Created Jun 11, 2020
Embed
What would you like to do?
const indiceDeProducto = (carrito, idProducto) => {
return carrito.findIndex(productoDentroDelCarrito => productoDentroDelCarrito.id === idProducto);
}
const existeProducto = (carrito, producto) => {
return indiceDeProducto(carrito, producto.id) !== -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment