mirror of
https://github.com/FranP-code/API-and-CRUD-for-Ecommerce-with-Node.js-FRONTEND.git
synced 2025-10-12 23:52:33 +00:00
modularizated scripts
This commit is contained in:
18
scripts/totalLogica.js
Normal file
18
scripts/totalLogica.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const registrarCambiosEnElTotal = (checkout) => {
|
||||
|
||||
const total = document.getElementById('precio')
|
||||
let totalSumado = 0
|
||||
|
||||
console.log(checkout)
|
||||
|
||||
for (const i in checkout) {
|
||||
|
||||
const product = checkout[i];
|
||||
|
||||
totalSumado = totalSumado + product.precioAcumulado
|
||||
}
|
||||
|
||||
total.innerText = totalSumado
|
||||
}
|
||||
|
||||
export default registrarCambiosEnElTotal
|
||||
Reference in New Issue
Block a user