I'm doing a sales system with firebase and javascript, I have products and I want to modify several of them at the same time with the following code only modifies me the first one
for (var i = 0; i < compra.length; i++) {
if (compra[i].value!=0){
var key=compra[i].getAttribute("key");
var cantidadcompra=compra[i].value;
refproductoeditar=refproductos.child(key);
refproductoeditar.update({
cantidad:cantidad-cantidadcompra,
})
}
}