## sum & mean

Hi,
Im trying to make a calculator that on click displays the sum of the data in the array and provides the mean/ average.

I have the formula for the mean = number of items(array.length?) * sum of array.

Can anyone recommend a superb/afordable/online javascript course?

<html>
<title>Aggregates</title>

<script type="text/javascript">

var array = new Array();

function insert(val)
{
array[array.length]=val;
}

function show()
{
var string="";
for(i = 0; i < array.length; i++)

document.getElementById("e").value = string =string+array[i]+"\n";

}

function sum(array)
{ numberTotal = 0
for (var total = 0; total < array.length; total = total + 1)

numberTotal = numberTotal + numberArray[total]

return numberTotal

document.getElementById("sum").value = numberTotal.value;
}

</script>

<body>
<h1>Aggregates</h1>

<h3>Add as many numbers as you like </br> to the list, then click Calculate.</h3>

<form id="form">
<input type="text" name="name" value="">
<input type="button" value="Add to list" onClick="insert(this.form.name.value),show();"></br>
<textarea name="txt" id="e" rows="10" ></textarea> </br>

<h4>Total (Sum)/h4>
<input type="text" id="Sum" value="0"></br>
<input type="button" value="Calculate" onClick="sum(array);"></input>

<h4>Average/h4>