mirror of
https://github.com/photonstorm/phaser
synced 2024-12-19 09:34:02 +00:00
23 lines
361 B
JavaScript
23 lines
361 B
JavaScript
/**
|
|
* [description]
|
|
*
|
|
* @function Phaser.Math.Average
|
|
* @since 3.0.0
|
|
*
|
|
* @param {number[]} values - [description]
|
|
*
|
|
* @return {number} [description]
|
|
*/
|
|
var Average = function (values)
|
|
{
|
|
var sum = 0;
|
|
|
|
for (var i = 0; i < values.length; i++)
|
|
{
|
|
sum += (+values[i]);
|
|
}
|
|
|
|
return sum / values.length;
|
|
};
|
|
|
|
module.exports = Average;
|