'Trying to add numbers from an a array?

im getting a output of the temperature i entered instead of getting the sum. im trying to get both the total f and c. I tried making totalf and totalc arrays instead of var. I dont know if returning the value would help?

var totalf=0;
    var totalc=0;
    
    
      var output = [fahrenheit,"      ",celsius+ '\r\n']; 
        for(var i = 0; i < output. length ; i++){
          totalf+=fahrenheit[i];
          totalc+=celsius[i];
          console.log(totalf[i],totalc[i]);
        }

tried doing this

function average() {
sum=0;
  for (let i = 0; i < document.getElementById('chart').value.length; i++) {
    sum +=  document.getElementById('chart').value(output[fahrenheit]);
     document.getElementById('chart').value=sum;
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source