Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

check average of array js, array

const getAverage = (arr) => arr.reduce((sum, num) => sum + num, 0) / arr.length;
const arr = [5, 13, 9, 11, 10, 15, 7];
const average = getAverage(arr);
console.log(average); // 10
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #check #average #array #array
ADD COMMENT
Topic
Name
6+3 =