I\'m trying, unsuccessfully, to add a new object to a current localStorage object. Instead of, at the end, having two sets of data in localStorage, I get the last one. Any insig
According to MDN The Object.assign() method only copies enumerable and own properties from a source object to a target object
in your case:
var stored = JSON.parse(retrievedObject); return array, you can just push new object to array: stored.push(newStudent2); and when set stored to localStorage.