I'm creating a POS system with ReactJS. Should I use a for loop to calculate the total amount? Is there any other way to do this?
let product = testProducts;
let subtotalEl = document.getElementsByClassName("Subtotal");
let quantity = document.getElementsByClassName("Quantity");
for (var i = 0; i < product.length; i++) {
subtotalEl[i].innerHTML = product[i].UnitPrice * quantity[i].value;
}