I'm trying to loop through the playedGames from an API. I need to place a new game between two teams in a new row in a table. I can only get the same game to be shown - and I can't figure out why. I put playedGames[i] since I hoped it would iterate throw all 13 games- but obviously not :-)
Here's the code:
        export function getMatchData() {
       return fetch('https://stryk.herokuapp.com/strycket2022')
    .then(function (response) {
      return response.json();
    })
    .then(function (data) {
      for (let i = 0; i < 12; i++) {
        return data.playedGames[i].teams[1].name + " VS " + data.playedGames[i].teams[2].name;
      }
    });
}