NOTE: I understand that the title is phrased ambiguously and the explanation below is simplistic, apologies I'm a little new to JS
I have this array of objects (this.listOfAnimals). I believe the purple represents the ids of each object.
I have a list of numbers below which are dynamically generated:
this.arrayOfNumbers = [0,1,2,3,4,5] which is set using:
while(this.firstNumber <= this.lastNumber) {
this.arrayOfNumbers.push(this.firstNumber++);
}
I need to get a list of items from this.listOfAnimals with ids = the numbers in the array this.arrayOfNumbers. How can I do this?
For example, I need a list of all items in this.listOfAnimals whose ids are 0,1,2,3,4,5 (coming from the array in the 2nd image). All of the data is dynamically generated so I can't use hardcoded code like this.listOfAnimals[0].