- script.js
JavaScript
var getStatistics = function (players) {
};
/* Technical assignment
Meow! I need a program that will calculate the usefulness and effectiveness of players based on their statistics. Design the code as a getStatistics function with one parameter: an array of players.
Each football player in this array is described by an object with three fields: name (property name), goals scored (property goals) and goal passes (property passes).
The function must return the same array, in which each player has two more fields added: effectiveness coefficient as per Muffin® (property coefficient) and performance (property percent).
The effectiveness coefficient is calculated like this: multiply the player’s goals by 2 (because I think that goals are the most important thing) and add all passes of the football player that resulted in a goal to this value.
The effectiveness (percentage of goals scored by a football player against the result of the whole team) is as follows: we determine the sum of the goals of all the players and find out how many percent of this number each football player scored. Round the value using Math.round().
*/