/* Stretch 1: Create a function called `getCountryWins` that takes the parameters `data` and `team initials` and returns the number of world cup wins that country has had.

Hint: Investigate your data to find "team initials"!
Hint: use `.reduce` */


fifa.js:
export const fifaData = [
{
Year: 1930,
Datetime: "13 Jul 1930 - 15:00",
Stage: "Group 1",
Stadium: "Pocitos",
City: "Montevideo",
"Home Team Name": "France",
"Home Team Goals": 4,
"Away Team Goals": 1,
"Away Team Name": "Mexico",
"Win conditions": "",
Attendance: 4444,
"Half-time Home Goals": 3,
"Half-time Away Goals": 0,
Referee: "LOMBARDI Domingo (URU)",
"Assistant 1": "CRISTOPHE Henry (BEL)",
"Assistant 2": "REGO Gilberto (BRA)",
RoundID: 201,
MatchID: 1096,
"Home Team Initials": "FRA",
"Away Team Initials": "MEX",
},

Respuesta :

The function called `getCountryWins` which takes the parameters `data` and `team initials` and returns the number of world cup wins that country has had is:

The function

function getCountryWins(FRA) {

initialValue,

currentIndex,

return total + currentValue getCountryWins(FRA);

"World Cup wins": 2,

array.reduce(function(total, currentValue, currentIndex, arr), initialValue)

}

The above function calls the function that contains the data and team initials of the country France and then uses the reduce() method executes a reducer function for the array element.

Read more about javascript here:

https://brainly.com/question/16698901

#SPJ1