Calculate average of an array in Javascript
 const average = (array) => array.reduce((a, b) => a + b) / array.length;

To use the function

let calculatedAverage = average(this.queue);