I've been working on creating a Cache Hashtable using JavaScript.
When I use the code cache.splice(0,0, ...dataPage);
, it inserts my data starting from the first position up to the length of dataPage.
Assuming that my dataPage size is always 10.
The expected structure of my cache array should be
[0: {..}, 1: {..} ..... 9: {...}]
Now, let's say I need to load the 5th page of data. Upon executing cache.splice(40,0, ...data);
,
I anticipate my array to look like
[[0: {..}, 1: {..} ..... 9: {...}, 40: {...}, 41:{...} ... 49{...}]
However, the actual result turns out to be
[[0: {..}, 1: {..} ..... 9: {...}, 10: {...}, 11:{...} ... 12{...}]
Any suggestions on how I can achieve the desired outcome?