Math._average = function (array) {
  var result = 0, index = 0;
  for (index in array) {
    result = result + array[index];
  }
  return result / array.length;
};

console.log(Math._average([2, 4, 8]));

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.