Suppose I serialize a linked list into JSON format and save it in a text file
const myList = new SinglyLinkedList();
myList.push('Bonjour');
myList.push('Monde');
myList.push('!');
myList.print();
fs.writeFile('./test.txt', JSON.stringify(myList), err => {
if (err) {
console.log(err);
return;
}
})
After reading the file and de-serializing the data, how can I add a new element to this linked list and re-serialize it?
Serialization only retains the object's state, so is there a way to update the list with a new element and serialize it again?