Find the average of a float array?

How could i get the average of a float array in javascript?
var arr : float;

for( var i = 0; i < arr.length; i++) {
sum += arr*;*
}
average = sum / arr.length;