After fetching data from a website and storing it in a variable, I have successfully implemented a for loop that returns 3 properties from the object every time a button is clicked.
However, the issue arises as the same data is returned with each button click. I am unsure of how to adjust the for loop to start from a specific object.
data: {
fetched_list: [], // holds fetched data
list: [], // empty list for future objects
list_key: '0' // last loop index
},
requestInformation(){
const temp = [];
for (let i = 0; i < 3; i++){
temp.push(this.fetched_list[i]);
}
this.list = this.list.concat(temp);
}
I am struggling to figure out how to make the for loop start at the next 3 objects when the button is clicked.
My attempt to save the last i number in list_key did not yield a solution on how to fetch the subsequent 3 properties.
For reference, you can view the problem here: https://jsfiddle.net/auq7wzuc/