JavaScript Average Program using Arrow Function


Average Program in JS

Example of Average program using arrow function

let avg = numbers =>{
	let sum = numbers.reduce((prev,current)=>prev+current);
	return sum/numbers.length;
};

avg([1,2,3,4,5,6]);
//Output : 3.5


Related

JavaScript Product Program using Arrow Function
Sum Program using Rest Paramater in JavaScript
Sum Program using reduce() method in JavaScript