Javascript array and variable not updating
Trying to update tatol and orders value but it isn't updating please help. let total = 0; let awaitingOrders = []; invoice.orders.map(async(order, i) =>{ await db.collection("orders") .doc(order.id).get().then(orderDoc => { total += orderDoc.data().total; awaitingOrder.push(order); } }).catch((error) => { console.log(error); }); console.log(total,…