300, count: 3 }, ... { price: 500, count: 2 }, ... { price: 400, count: 3 }, ... ]; > const consumedCounts = [0, 0, 0, 2, 4, 5, 8]; > let calcConsumedPriceSum; > import("./src/lib/calcConsumedPriceSum.js").then((module) => calcConsumedPriceSum = module.default); > calcConsumedPriceSum(stocks, consumedCounts); [ 0, 0, 0, 600, 1400, 1900, 3100 ] by @tekihei2317