Results 1 to 3 of 3
Thread: calculating the average/mean
Mar 31, 2011, 00:08 #1
- Join Date
- Mar 2011
- 0 Post(s)
- 0 Thread(s)
calculating the average/mean
Im trying to calculate the mean/average of numbers in an array any suggestions with the mean() would be very much appreciated.
how can i get the length of an array to perform in a simple / maths problem whilst being flexiable to the length of the array?
for (i=0, total=0;i <numbers.length; i++)
total += numbers[i];
document.getElementById("txtTotal").value = total;
document.getElementById("answer") = parseFloat(document.getElementById("txtTotal").value) / parseFloat(numbers.length);