Create a JavaScript function name amountTotal(). The purpose of the amountTotal function is to return the sum of all of the values in an array named amount. The function has one parameter, arraySize, which is the number of elements in the amount array. Add the following commands to the function: Declare a variable total, setting its initial value to 0. create a for loop the loops through all of the values in the amount array. At each iteration of the loop add the current value of the array item to the value of the total variable. After for loop is completed, return the value of the total variable
Explanation / Answer
var val=document.getElementById('userInput').value; var temp=val.split(" "); function sum(){ for(var i=0,MISSING THIS BIT document.getElementById('resultSum').innerHTML=MISSING THIS BIT; }