Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript calculate average of array

const sum = times.reduce((a, b) => a + b, 0);
const avg = (sum / times.length) || 0;

console.log(`The sum is: ${sum}. The average is: ${avg}.`);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #calculate #average #array
ADD COMMENT
Topic
Name
8+1 =