I need to save user input, push to an array, then stringify to localstorage, those parts are seemingly working perfectly fine
inputs in local storage
except when i try to parse the data back out
[inputs being displayed on webpage as object Object
ive tried looking at a couple forums but i havent found something that works on this
my code is saving user inputs to local storage
// Todo: create a function to handle adding a new task
function handleAddTask(event) {
console.log("FUCCKCCCC")
//taskTitle
//datepicker
//taskDescr
// const title = taskTitle.value;
// const date = datepicker.value;
// const desc = taskDescr.value;
console.log("smbody get me through this nightmaare");
let Cake = {
title: taskTitle.value,
date: datepicker.value,
desc: taskDescr.value,
}
fruitCake.push({Cake});
localStorage.setItem('fruitCake', JSON.stringify(fruitCake));
// localStorage.setItem('title', title);
// localStorage.setItem('date', date);
// localStorage.setItem('desc', desc)
console.log("i cant eat this sheeeeelf");
}
Theyre all being called, its pushing to
let fruitCake = [];
this array as near as i can tell
function fork(){
handleAddTask();
renderTaskList();
}
gregory();
$("#test").on('click', createTaskCard);
$("#pikap").click(fork);
i thought the issue was here
function gregory() {
const perry = JSON.parse(localStorage.getItem('fruitCake'));
if (perry !== null) {
fruitCake = perry;
}
renderTaskList();
} ```
but someone said inside of the fruitCake.push({Cake}); it wasnt pushing because cake was already an object so it was an object inside an object
i asked if i needed to change one of the cakes then and never got an answer so now im kind of more confused than when i started
I tried changing the names of one of the cakes but it didnt work
[picture of the websites issue, throwing up objects instead of parsing the data](https://i.sstatic.net/jtJBDMjF.png)
Yunios is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.