@jZero/

BarrenLoyalMussel

JavaScript

No description

fork
loading
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function average(array){

	let total = 0 
	array.forEach(function(v){
     return  total += v;
    });

    return total/array.length
}

var scores  = [90, 98, 89, 100, 100, 86, 94];
console.log(average(scores)); // 94

var scores2  = [40,65,77,82,80,54,73,63,95,49];
console.log(average(scores2)); // 68
Native Browser JavaScript