weightedAverage
Calculates the weighted average of two or more numbers.
- Use
Array.prototype.reduce()
to create the weighted sum of the values and the sum of the weights. - Divide them with each other to get the weighted average.
Calculates the weighted average of two or more numbers.
Array.prototype.reduce()
to create the weighted sum of the values and the sum of the weights.