Aquí tengo una función de cálculo genérica.
private calculateTotal(order: InventoryOrder):number{ let total = 0.0; if(order && order.currentInventory){ order.currentInventory.forEach(x =>{ console.log(x.quantity); console.log("helloworld"); } //error appears here<- "," expected. } return total; }Probé un código muy similar en https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
const array1 = ['a', 'b', 'c']; array1.forEach(element => { console.log(element); console.log("helloworld"); }); // expected output: "a" // expected output: "b" // expected output: "c"¿Tienes idea de lo que está pasando?
private calculateTotal(order: InventoryOrder):number{ let total = 0.0; if(order && order.currentInventory){ order.currentInventory.forEach(x =>{ console.log(x.quantity); console.log("helloworld"); }); } return total; }