My code works, but it seems to be running exceptionally slow.
I have an array of values to search, and I have a JSON that I'm filtering.
var JSONPull;
var FilterJSON = [];
var TypeIDs = [34,35,36,37,38,39,40,11399,1230,17470,17471,1228,17463,17464,1224,17459,17460,18,17455,17456,1227,17867,17868,20,17452,17453,1226,17448,17449,21,17440,17441,1231,17444,17445,1229,17865,17866,1232,17436,17437,19,17466,17467,1225,17432,17433,1223,17428,17429,22,17425,17426,11396,17869,17870];
fetch('URL API')
.then(res => res.json())
.then((out) => {
JSONPull = out;
TypeIDs.forEach(function (index){
FilterJSON = JSONPull.filter((element) => {
console.log("index: "+index);
console.log(element);
console.log("type_id: "+ element.type_id);
element.type_id === index;
});
})
})
The console.logs are more just to watch the code while testing, but definitely shouldn't be causing these performance issues.
Thanks in advance for any help/assistance