program the average Excel function in javascript or another language

2

I need help to know how I can calculate the average of this table, where the third column is the value to calculate in excel The formula would be something like this: Promedio(0.63,518:461,0.60:0.70); just that I can not think of how to program it.

    
asked by carlos 12.09.2016 в 03:11
source

1 answer

1

If you want to calculate the average of all the values of a Array it's quite simple in JavaScript.

The Array object has a wonderful method reduce with which you can get what you want in a very elegant way:

const sum = values.reduce((a, b) => a + b)
const avg = sum / values.length
    
answered by 12.09.2016 в 08:21