Average of All Indexes of Array

 let array_1 = [1, 7, 9, 12, 6, 10, 2, 11, 9, 8];
    let average;
    let total = 0;
    for(var i=0; i<array_1.length; i++){
          total = ((total + array_1[i]));
    }
        
    average = (total/(array_1.length));
    console.log(average);

Comments

Popular posts from this blog

JavaScript Coding Challenge-8

Largest and Lowest Number of the Array using JavaScript