Answers for "create a function to find the sum of elements in an array and use that function to find out the average in javascriptwith example"

1

get average and sum javascript

var sum = array.reduce((a, b) => a + b, 0);	//get sum of all elements in array
var avg = (sum / array.length) || 0; //get average of all elements in array ;)
Posted by: Guest on October-10-2021

Code answers related to "create a function to find the sum of elements in an array and use that function to find out the average in javascriptwith example"

Code answers related to "Javascript"

Browse Popular Code Answers by Language