Calculating the Average of an Array in JavaScript

const numbers = [10, 15, 20, 25, 30];
const average = numbers.reduce((acc, curr) => acc + curr, 0) / numbers.length;
console.log('Average of Array Elements:', average);

Continue Reading

Handpicked posts just for you — based on your current read.

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!