Skip to content

Commit

Permalink
se elimino funcion duplicada para recalcular costo
Browse files Browse the repository at this point in the history
  • Loading branch information
paolofajardo committed Oct 30, 2023
1 parent 5c6806f commit 44b9291
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions js/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,6 @@ function eliminarProducto(botonEliminar) {
recalcular();
}

function recalcular() {
let cantidad = document.getElementsByClassName('cantidad');
let resultado = document.getElementsByClassName('subtotal');
let precio = document.getElementsByClassName('precio');

for (let i = 0; i < precio.length; i++) {
let cantidadValue = parseFloat(cantidad[i].value);
let precioValue = parseFloat(precio[i].querySelector('.precio').innerHTML);
if (isNaN(cantidadValue)) {
cantidadValue = 1;
}
resultado[i].innerHTML = (cantidadValue * precioValue).toFixed(2);
}
}

function recalcular() {
let cantidad = document.getElementsByClassName('cantidad');
let resultado = document.getElementsByClassName('subtotal');
Expand Down

0 comments on commit 44b9291

Please sign in to comment.