Solución
solution.tsTypeScript
export function weightedAverage(values: number[], weights: number[]): number {
let avg = 0;
for( const index in values) {
const value = values[index]
const weight = weights[index];
avg += value * weight;
}
const avgPon = weights.reduce((prev, curr) => prev + curr ,0)
return avg / avgPon;
}0respuestas