0 added
0 removed
Original
2026-01-01
Modified
2026-03-09
1
<p>Muffin respects football, but sometimes he is too lazy busy to watch games. But he doesn’t worry, because it’s enough for a cat to know the names of the best scorers and their effectiveness in order to bet on a player to keep the conversation going at the right time.</p>
1
<p>Muffin respects football, but sometimes he is too lazy busy to watch games. But he doesn’t worry, because it’s enough for a cat to know the names of the best scorers and their effectiveness in order to bet on a player to keep the conversation going at the right time.</p>
2
<p>While you were writing the game, a letter from Muffin arrived. It was marked “I needed it done yesterday”.</p>
2
<p>While you were writing the game, a letter from Muffin arrived. It was marked “I needed it done yesterday”.</p>
3
<blockquote><p>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.</p>
3
<blockquote><p>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.</p>
4
<p>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).</p>
4
<p>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).</p>
5
<p>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).</p>
5
<p>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).</p>
6
<ul><li>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 by the football player that resulted in a goal to this value.</li>
6
<ul><li>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 by the football player that resulted in a goal to this value.</li>
7
<li>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().</li>
7
<li>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().</li>
8
</ul></blockquote><p>Let’s calculate what percentage the number is:</p>
8
</ul></blockquote><p>Let’s calculate what percentage the number is:</p>
9
// Total value, that is 100% 1200 // How many percent is 225 from 1200 (225 * 100) / 1200 = 18.75 // After rounding with Math.round() 19<p>When you are done, press Hey boss, here’s your program! in the console, and Muffin will call function getStatistics and test the results of your work. Good luck!</p>
9
// Total value, that is 100% 1200 // How many percent is 225 from 1200 (225 * 100) / 1200 = 18.75 // After rounding with Math.round() 19<p>When you are done, press Hey boss, here’s your program! in the console, and Muffin will call function getStatistics and test the results of your work. Good luck!</p>