Create a JavaScript function name amountTotal(). The purpose of the amountTotal
ID: 3660505 • Letter: C
Question
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 variableExplanation / 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; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.