0

I am trying to find the average price of my object array and have become stuck on the .forEach method callback function.

here is what I have.

import Product from "./models/Product";

const product: Product[] = [ { name: "pre-workout", price: 59.99, }, { name: "wrist-wraps", price: 11.99, }, { name: "liquid-chalk", price: 9.99, }, ];

const calcAverageProductPrice = (arrayOfProducts: Product[]): number =>{ const average = arrayOfProducts.forEach((item)=>{

})

}

0 Answers0