Created
June 11, 2020 02:20
-
-
Save parzibyte/788341896f04c7b3490aa111c1b5b30e to your computer and use it in GitHub Desktop.
This file contains 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 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