I have a challenge where I need to add multiple items to an array without overriding them.
My initial approach was like this:
localForage.getItem("data", (err, results) => {
console.log('results', results)
// var dataArray = results ? results : [];
// data.push(results);
this.dataArray.push(results);
localForage.setItem("data", results);
console.log(localForage.getItem("data"));
})
However, this code snippet is replacing the last item. How can I successfully push multiple localForage
items into that dataArray?