I have a list of objects (called this.listOfDesserts):
Each object (this.listOfDesserts) containing the following:
I also have a variable called this.relevantColumns which is dynamically generated though a line of code like so:
this.relevantColumns = this.listOfCakes.summaryCakes.numberOfUsers;
The end result is always an array. As an example it could equal something like ['1305','1306']
How can I generate a list from this.listOfDesserts of all objects where the index (In the 2nd image I believe it's represented by the purple e.g. 1304,1305,1306,1307,1308,header,id) is equal to the values of an array (this.relevantColumns)?
In this example how would I be able to get a list of all objects in this.listOfDessert with indexes 1305 and 1306 without hardcoding?
Everything is written dynamically so I can't really use hardcoded lines like this.variableName[1304].