I was just testing this on a basic level. Each time I run the fetch request, my array grows. it started with <200 results and now Iโm over 5000. It isnโt a local problem, because when I change the variable, the result is the same (huge fetch return). How/Why am I getting a larger request each time. I would like the id-list data that I pull to remain the same .length
Here is my very simple code:
const options = {
method: "GET",
headers: {
"X-RapidAPI-Key": "{myapikey}",
"X-RapidAPI-Host": "mobafire-lol-builds.p.rapidapi.com",
},
};
var ChampId = [];
function getChampList(){
fetch(
"https://mobafire-lol-builds.p.rapidapi.com/api/champions/id-list",
options
)
.then((response) => response.json())
.then(function (data) {
ChampId = data;
// Use the console to examine the response
console.log(ChampId);
});
}
getChampList();
Join in the discussion - add comment below: